Class NormalDoubleGenerator

java.lang.Object
io.bloviate.gen.AbstractDataGenerator<Double>
io.bloviate.gen.NormalDoubleGenerator
All Implemented Interfaces:
DataGenerator<Double>

public class NormalDoubleGenerator extends AbstractDataGenerator<Double>
Generates double values from a normal (Gaussian) distribution with the configured mean and standard deviation, clamped to the inclusive range [min, max]. Useful when a numeric column should cluster around a central value rather than spread uniformly (prices, scores, measurements).

Clamping (rather than re-drawing) keeps generation O(1) and reproducible; values beyond the bounds pile up slightly at min/max, so choose a range a few standard deviations wide to keep that mass negligible.

Since:
2.11.0
  • Method Details

    • generate

      public Double generate()
      Description copied from interface: DataGenerator
      Generates a random value of type T.
      Returns:
      a generated value, may be null if the generator supports nullable columns
    • set

      public void set(Connection connection, PreparedStatement statement, int parameterIndex, Double value) throws SQLException
      Description copied from interface: DataGenerator
      Sets a specific value on a PreparedStatement parameter.
      Specified by:
      set in interface DataGenerator<Double>
      Overrides:
      set in class AbstractDataGenerator<Double>
      Parameters:
      connection - the database connection
      statement - the prepared statement to set the parameter on
      parameterIndex - the 1-based parameter index
      value - the value to set
      Throws:
      SQLException - if the database operation fails
    • get

      public Double get(ResultSet resultSet, int columnIndex) throws SQLException
      Description copied from interface: DataGenerator
      Retrieves a value from a ResultSet column.
      Parameters:
      resultSet - the result set to read from
      columnIndex - the 1-based column index
      Returns:
      the value from the result set, properly cast to type T
      Throws:
      SQLException - if the database operation fails