What is best way to set_rand?
- Posted by SnakeCharmer Jan 24, 2013
- 1274 views
I read documentation:
When set_rand() is called with a single integer or atom, the two internal seeds are derived from the parameter.
When set_rand() is called with a sequence of exactly two integers/atoms the internal seeds are set to the parameter values.
When set_rand() is called with an empty sequence, the internal seeds are set to random values and are unpredictable. This is how to reset the generator.
When set_rand() is called with any other sequence, the internal seeds are set based on the length of the sequence and the hashed value of the sequence.
When set_rand() is called with a sequence of exactly two integers/atoms the internal seeds are set to the parameter values.
When set_rand() is called with an empty sequence, the internal seeds are set to random values and are unpredictable. This is how to reset the generator.
When set_rand() is called with any other sequence, the internal seeds are set based on the length of the sequence and the hashed value of the sequence.
I want to use two values as seeds for set_rand. How many bit these values have in width? What is best way to use hashes (of external data) as seeds?
atom Hash1 = hash(data1, ALGORITHM) atom Hash2 = hash(data2, ALGORITHM) set_rand({Hash1, Hash2})
It is correct? What ALGORITHM is better in this case? HSIEH30 or something 32-bit? 64-bit? More? When I put a line to set_rand, in what it turns? HSIEH32?