Description
Change the number factory methods for nextFloat and nextDouble.
Currently the methods use:
- 23-bits of state from an int to create a float
- 52-bits of state from a long to create a double
This method produces output floating point numbers with the final bit of the mantissa set to 0. The methods can be changed to use 24-bits and 53-bits of state respectively.
This will match the implementation in java.util.SplittableRandom.
Benchmarking has shown no noticeable difference in speed.
Note that this change modifies the output float to evenly sample all k/2^-24 dyadic rationals and the double to evenly sample all k/2^-53 dyadic rationals, i.e. the maximum number representable between 0 (inclusive) and 1.0 (exclusive).
Attachments
Issue Links
- is related to
-
RNG-79 Benchmark methods for producing nextDouble
- Closed
- links to