You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Alex D Herbert (JIRA)" <ji...@apache.org> on 2019/03/06 16:32:00 UTC
[jira] [Updated] (RNG-81) NumberFactory to evenly sample all
representable rationals between 0 and 1
[ https://issues.apache.org/jira/browse/RNG-81?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alex D Herbert updated RNG-81:
------------------------------
Summary: NumberFactory to evenly sample all representable rationals between 0 and 1 (was: NumberFactory)
> NumberFactory to evenly sample all representable rationals between 0 and 1
> --------------------------------------------------------------------------
>
> 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
> Priority: Major
> 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)