Class JsIntGen

java.lang.Object
jsonvalues.gen.JsIntGen
All Implemented Interfaces:
fun.gen.Gen<JsInt>, Function<Random,Supplier<JsInt>>

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

 import fun.gen.Gen;
 import jsonvalues.JsInt;

 Gen<Integer> intGen = seed -> () -> {...};
 Gen<JsInt> jsIntGen = gen.map(JsInt::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
    apply(Random seed)
     
    static fun.gen.Gen<JsInt>
    Returns a generator that produces values with a uniform distribution.
    static fun.gen.Gen<JsInt>
    arbitrary(int min)
    Returns a generator that produces values uniformly distributed over the interval [min,Integer.MAX_VALUE].
    static fun.gen.Gen<JsInt>
    arbitrary(int min, int max)
    Returns a generator that produces values uniformly distributed over a specified interval.
    static fun.gen.Gen<JsInt>
    Returns a biased generator that produces potential problematic values with a higher probability.
    static fun.gen.Gen<JsInt>
    biased(int min)
    Returns a biased generator that produces potential problematic values with a higher probability.
    static fun.gen.Gen<JsInt>
    biased(int min, int 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<JsInt> biased()
      Returns a biased generator that produces potential problematic values with a higher probability. These values include: - Integer.MIN_VALUE - Short.MIN_VALUE - Byte.MIN_VALUE - 0 - Integer.MAX_VALUE - Short.MAX_VALUE - Byte.MAX_VALUE
      Returns:
      A biased JsInt generator.
    • arbitrary

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

      public static fun.gen.Gen<JsInt> arbitrary(int min, int 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 JsInt generator.
    • arbitrary

      public static fun.gen.Gen<JsInt> arbitrary(int min)
      Returns a generator that produces values uniformly distributed over the interval [min,Integer.MAX_VALUE].
      Parameters:
      min - The lower bound of the interval (inclusive).
      Returns:
      A JsInt generator.
    • biased

      public static fun.gen.Gen<JsInt> biased(int min, int 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 And the following numbers, provided that they are between the specified interval: - Integer.MIN_VALUE - Short.MIN_VALUE - Byte.MIN_VALUE - 0 - Integer.MAX_VALUE - Short.MAX_VALUE - Byte.MAX_VALUE
      Parameters:
      min - The lower bound of the interval (inclusive).
      max - The upper bound of the interval (inclusive).
      Returns:
      A biased JsInt generator.
    • biased

      public static fun.gen.Gen<JsInt> biased(int min)
      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 Integer.MAX_VALUE And the following numbers, provided that they are between the specified interval: - Integer.MIN_VALUE - Short.MIN_VALUE - Byte.MIN_VALUE - 0 - Integer.MAX_VALUE - Short.MAX_VALUE - Byte.MAX_VALUE
      Parameters:
      min - The lower bound of the interval (inclusive).
      Returns:
      A biased JsInt generator.
    • apply

      public Supplier<JsInt> apply(Random seed)
      Specified by:
      apply in interface Function<Random,Supplier<JsInt>>