Skip to content

Use Xoshiro256PlusPlus in examples/rayon-monte-carlo.rs#1805

Open
dhardy wants to merge 2 commits into
masterfrom
push-yqlxzvmqrmnz
Open

Use Xoshiro256PlusPlus in examples/rayon-monte-carlo.rs#1805
dhardy wants to merge 2 commits into
masterfrom
push-yqlxzvmqrmnz

Conversation

@dhardy

@dhardy dhardy commented Jul 6, 2026

Copy link
Copy Markdown
Member

Summary

  • Add the xoshiro PRNGs in rand::rngs to the local benchmark (redundant with the rngs repo benchmark).
  • Remove SmallRng and StdRng from this benchmark (both are thin wrappers around another benchmarked PRNG)
  • Adapt the rayon-monte-carlo example to use Xoshiro256PlusPlus instead of ChaCha8Rng

Motivation

Upon consideration of #1781, it occurs to me that there is very little reason to use a thread-local SmallRng instead of a new local one. (In fact, a thread-local one would likely perform worse if we were to use the same per-usage locking as we do in ThreadRng.)

Details

The rayon example now uses multiple seeds instead of a single seed with multiple streams/jumps. I believe this is acceptable. We could instead use jump or jump_n, though (a) we don't have those facilities in the rand::rngs code and (b) I see no reason why this would be preferable. See also the book: parallel RNGs. CC @vigna.

@dhardy dhardy requested a review from vks July 6, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant