Class Floats

    • Constructor Detail

      • Floats

        protected Floats()
      • Floats

        public Floats​(MockNeat mockNeat)
    • Method Detail

      • floats

        public static Floats floats()

        Returns a Floats object than can be used to generate random float numbers.

        Note: By default it generates float numbers in the [0.0f, 1.0f) range.

        Returns:
        A re-usable Floats object. The Floats class implements MockUnitFloats.
      • supplier

        public java.util.function.Supplier<java.lang.Float> supplier()
        Description copied from interface: MockUnit
        This is the sole abstract method of the interface. Needs to be implemented every-time a MockUnit is implemented.
        Specified by:
        supplier in interface MockUnit<java.lang.Float>
        Returns:
        A Supplier<T>.
      • range

        public MockUnitFloat range​(float lowerBound,
                                   float upperBound)

        Returns a new MockUnitFloat that can be used to generate random float values in a given range [lowerBound, upperBound).

        Parameters:
        lowerBound - The upper bound of the interval.
        upperBound - The lower bound of the interval.
        Returns:
        A new MockUnitFloat.
      • bound

        public MockUnitFloat bound​(float bound)

        Returns a new MockUnitFloat that can be used to generate float values bounded by a specific value: [0, bound).

        Parameters:
        bound - The float bound.
        Returns:
        A new MockUnitFloat.
      • from

        public MockUnitFloat from​(float[] alphabet)

        Returns a new MockUnitFloat that can be used generate float values from a given "alphabet".

        Parameters:
        alphabet - An array of values from where the values are randomly picked.
        Returns:
        A new MockUnitFloat.