[ 
https://issues.apache.org/jira/browse/RNG-168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17512743#comment-17512743
 ] 

Alex Herbert commented on RNG-168:
----------------------------------

h2. L32X64Mix

The lea32 mix function is not provided in the JDK 17 javadoc or the paper by 
Steele & Vigna. I contacted the authors and Guy Steele provided the lea32 mix 
function as reference c code. Due to an unfortunate restriction on the paper's 
length the lea32 method was omitted from the paper. All the other mixers are 
provided in figure 4 of the paper. Guy Steele has provided the code which is 
under no restrictions by Doug Lea (who identified the constants) or Oracle. 
Ideally the code would have been in the paper but did not make it in the final 
release revision.

I will add a L32X64Mix 32-bit generator to complement the 64-bit generators. 
The base XBG generator is XoRoShiRo64 and the period will be 2^32 (2^64 - 1) 
with 128-bits of state.

Although the jumps will be small this generator can be made jumpable. A single 
cycle of the LCG will jump (2^64 -1) and advancing the LCG by 2^16 steps would 
have a long jump of 2^16 (2^64 -1). Note that the other jumpable 32-bit 
generator XoShiRo128 has jumps of 2^64 and 2^96. So the jump for the LXM 
generator is equivalent in size, and the long jump is smaller.

 

> LXM family of random number generators
> --------------------------------------
>
>                 Key: RNG-168
>                 URL: https://issues.apache.org/jira/browse/RNG-168
>             Project: Commons RNG
>          Issue Type: New Feature
>          Components: core, simple
>    Affects Versions: 1.4
>            Reporter: Alex Herbert
>            Priority: Major
>         Attachments: lcg128carry.jpg
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> JDK 17 updates the random number support and adds a LXM family of random 
> number generators. The generators are described in the following paper:
> {noformat}
> Steele and Vigna (2021)
> LXM: better splittable pseudorandom number generators (and almost as fast). 
> Proceedings of the ACM on Programming Languages, Volume 5, Article 148, pp 
> 1–31
> {noformat}
> [https://doi.org/10.1145/3485525]
> The generators mix the output of a linear conguential generator (LCG; L) and 
> a Xor-based generator (XBG; X). The paper provides code examples for 
> L64X128MixRandom and L128X256MixRandom from JDK 17.
> Details of the combinations of the linear conguential generator (LCG; L) and 
> Xor-based generators (XBG; X) used in JDK 17 are provided in the package 
> javadoc:
> [JDK 17 
> java.util.random|https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/random/package-summary.html]
> The current commons RNG library implements all the XBG generators. Adding 
> support for these generators should add a LCG to combine with the output of 
> the XBG via the specified mix function.
> All constants are supplied in the JDK 17 package javadoc to allow 
> implementation with the exception of the mixing functions lea32 and lea64. 
> The lea64 function is provided in the paper above but the reference origin is 
> personal communication with Doug Lea (2013). Thus the lea32 mix function for 
> 32-bit generators is not published. Obtaining from the JDK source code is 
> possible but would be subject to the Java licence.
> The generators support jump functionality and are suitable for streaming in 
> large numbers for parallel applications (the paper tests up to 2^24 
> generators) by using a different additive constant for the LCG for each 
> generator to ensure no sequence overlap. Creating a new additive constant is 
> significantly faster than performing a jump operation.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to