Skip to content

Why does setting the seed in one mirai_map() use the same seed in another one? #271

Answered by shikokuchuo
etiennebacher asked this question in Q&A
Discussion options

You must be logged in to vote

Attempting to set the seed in each iteration of a mirai_map() call is probably not what you'd want, as you get the same random results (as you found).

A bit more about why the behaviour is like this: mirai uses L'Ecuyer CMRG to provide parallel-safe random streams. That means random results in each daemon are independent from one another. The random seed is not reset after each mirai call by design. This is to ensure that however many random draws are made in any mirai call, the next random draw follows on in the stream, and hence have the desired statistical properties.

Once you set the seed in a mirai call, then subsequent calls will follow on, hence your findings.

It's nothing to do wi…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@etiennebacher
Comment options

Answer selected by etiennebacher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #270 on April 23, 2025 22:27.