[
https://issues.apache.org/jira/browse/RNG-188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18057565#comment-18057565
]
Alex Herbert commented on RNG-188:
----------------------------------
PR here: [PR 191|https://github.com/apache/commons-rng/pull/191]
Performance figures from the PR:
{noformat}
nextDouble BASELINE avgt 10 0,390 ± 0,001 ns/op
nextDouble JDK avgt 10 14,578 ± 0,007 ns/op
nextDouble PHILOX_4X32 avgt 10 7,121 ± 0,007 ns/op
nextDouble PHILOX_4X64 avgt 10 8,059 ± 0,009 ns/op
nextDouble WELL_512_A avgt 10 4,709 ± 0,005 ns/op
{noformat}
As you can see they are not the fastest generators, but are for most purposes
fast enough and the ease and flexibility of parallelization makes up for the
generation speed. The 64-bit version could be faster with
Math.unsignedMultipliedHigh of Java 19.
> Add Philox random number generator
> ----------------------------------
>
> Key: RNG-188
> URL: https://issues.apache.org/jira/browse/RNG-188
> Project: Commons RNG
> Issue Type: New Feature
> Components: core
> Reporter: Alex Herbert
> Priority: Minor
>
> Add two new random number generators: philox4x32 and philox4x64 from
> [https://www.thesalmons.org/john/random123/]
> These are quite standard nowadays (part of CUDA, Numpy, default for Pytorch
> on GPU, default for TensorFlow) and there is no official Java implementation.
> Counter-based PRNGs are great for parallelization, as skipping-ahead is
> nearly as fast as a single random number generation, and the counter makes it
> very easy to create subsequences.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)