JuliaRandom / Random123.jl

Julia implementation of Random123.
http://juliarandom.github.io/RandomNumbers.jl/stable/man/random123/
Other
18 stars 5 forks source link

Add functional variant of threefry #15

Closed jw3126 closed 2 years ago

jw3126 commented 2 years ago

In some contexts, mutable structs are problematic (for instance on GPU). This adds a low-level purely functional way to use threefry. If there is interest in this, I will add functional variants of the other rngs as well. I can also add a convenience function for functional counter increment if desired.

jw3126 commented 2 years ago

@sunoru any thoughts on having a side effect-free low-level API?

sunoru commented 2 years ago

Sorry for replying late! Having such low-level APIs sounds useful. Can you also help add them to other RNGs?

jw3126 commented 2 years ago

@sunoru I added the other rngs. Currently aesni and ars operate on __m128i which I am not sure we want to expose? Should I sandwich aesni and ars in conversion functions that let them operate on UInt128 instead?

sunoru commented 2 years ago

Sure I guess we can just also have a version of aesni and ars to operate on UInt128 values.

jw3126 commented 2 years ago

I added such aesni and ars could you run CI?

sunoru commented 2 years ago

OK! BTW, I think it's OK to export these functions.

codecov-commenter commented 2 years ago

Codecov Report

Merging #15 (c9c5f3d) into master (73adf98) will increase coverage by 0.05%. The diff coverage is 100.00%.

:exclamation: Current head c9c5f3d differs from pull request most recent head f49cdfc. Consider uploading reports for the commit f49cdfc to get more accurate results

@@            Coverage Diff             @@
##           master      #15      +/-   ##
==========================================
+ Coverage   98.57%   98.63%   +0.05%     
==========================================
  Files           7        7              
  Lines         842      879      +37     
==========================================
+ Hits          830      867      +37     
  Misses         12       12              
Impacted Files Coverage Δ
src/aesni.jl 99.09% <100.00%> (+0.13%) :arrow_up:
src/ars.jl 98.66% <100.00%> (+0.30%) :arrow_up:
src/philox.jl 98.63% <100.00%> (+0.08%) :arrow_up:
src/threefry.jl 99.54% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us.

sunoru commented 2 years ago

Looks good to me. Thanks very much!