Class JsDoubleGen

java.lang.Object
jsonvalues.gen.JsDoubleGen
All Implemented Interfaces:
fun.gen.Gen<JsDouble>, Function<RandomGenerator,Supplier<JsDouble>>

public final class JsDoubleGen extends Object implements fun.gen.Gen<JsDouble>
Represents a JsDouble generator. It can be created using the static factory methods biased() and arbitrary() or, if none of the previous suits your needs, from a double generator and the function map:

 import fun.gen.Gen;
 import jsonvalues.JsDouble;

 Gen<Double> doubleGen = seed -> () -> {...};
 Gen<JsDouble> jsDoubleGen = gen.map(JsDouble::of);
 

Arbitrary generators produce values with a uniform distribution. Biased generators produce potential problematic values with a higher probability, which can help identify and test edge cases.

  • Method Summary

    Modifier and Type
    Method
    Description
     
    static fun.gen.Gen<JsDouble>
    Returns a generator that produces values with a uniform distribution.
    static fun.gen.Gen<JsDouble>
    arbitrary(double min, double max)
    Returns a generator that produces values uniformly distributed over a specified interval.
    static fun.gen.Gen<JsDouble>
    Returns a biased generator that produces potential problematic values with a higher probability.
    static fun.gen.Gen<JsDouble>
    biased(double min, double max)
    Returns a biased generator that produces potential problematic values with a higher probability.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.util.function.Function

    andThen, compose

    Methods inherited from interface fun.gen.Gen

    classify, classify, collect, collect, distinct, distinct, map, peek, sample, sample, sample, suchThat, suchThat, then
  • Method Details

    • biased

      public static fun.gen.Gen<JsDouble> biased()
      Returns a biased generator that produces potential problematic values with a higher probability. These values include: - The minimum double value - The maximum double value - 0.0
      Returns:
      A biased JsDouble generator.
    • arbitrary

      public static fun.gen.Gen<JsDouble> arbitrary()
      Returns a generator that produces values with a uniform distribution.
      Returns:
      A JsDouble generator.
    • biased

      public static fun.gen.Gen<JsDouble> biased(double min, double max)
      Returns a biased generator that produces potential problematic values with a higher probability. These values include: - The lower bound of the interval - The upper bound of the interval - 0.0
      Parameters:
      min - The lower bound of the interval (inclusive).
      max - The upper bound of the interval (inclusive).
      Returns:
      A biased JsDouble generator.
    • arbitrary

      public static fun.gen.Gen<JsDouble> arbitrary(double min, double max)
      Returns a generator that produces values uniformly distributed over a specified interval.
      Parameters:
      min - The lower bound of the interval (inclusive).
      max - The upper bound of the interval (inclusive).
      Returns:
      A biased JsDouble generator.
    • apply

      public Supplier<JsDouble> apply(RandomGenerator seed)
      Specified by:
      apply in interface Function<RandomGenerator,Supplier<JsDouble>>