Alex D Herbert created RNG-81:
---------------------------------

             Summary: NumberFactory
                 Key: RNG-81
                 URL: https://issues.apache.org/jira/browse/RNG-81
             Project: Commons RNG
          Issue Type: Improvement
          Components: core
    Affects Versions: 1.3
            Reporter: Alex D Herbert
            Assignee: Alex D Herbert
             Fix For: 1.3


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|https://en.wikipedia.org/wiki/Dyadic_rational] 
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).

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to