[erlang-questions] Requirements for seed integers in the rand module
Krzysztof Jurewicz
krzysztof.jurewicz@REDACTED
Tue Aug 7 13:23:04 CEST 2018
The seed/2 and seed_s/2 functions in the rand module take a 3-element tuple of integers as a seed, however it doesn’t document what are the requirements for those integers (how they need to be distributed). If seed is omitted (the seed/1 and seed_s/1 functions), then the following (undocumented) value is used:
{erlang:phash2([{node(),self()}]),
erlang:system_time(),
erlang:unique_integer()}
I have 64 bytes of entropy which I want to use as a seed. Is it ok to do it in the way below?
{binary:decode_unsigned(Entropy), 0, 0}
More information about the erlang-questions
mailing list