in reply to Re: Getting srand's seed
in thread Getting srand's seed
I tried using my own value with:
$seed = int(rand(1e10));
But then some numbers appeared way more often than you would expect.
Using that worked much better:
$seed = int(rand(2**31));
No idea why...
But since I'm messing around with creating my own seed, I will probably go with the "recommended" way (in the srand function documentation):
$seed = time ^ ($$ + ($$ << 15));
I looked at the Math::Random::* option. It seems like Math::Random has a random_get_seed function, which is really what I want. But do I want to add this module dependency, just to retrieve a seed value??
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Getting srand's seed
by GrandFather (Saint) on Oct 10, 2008 at 02:43 UTC | |
by fangly (Initiate) on Oct 10, 2008 at 03:26 UTC | |
by GrandFather (Saint) on Oct 10, 2008 at 05:36 UTC | |
by fangly (Initiate) on Oct 10, 2008 at 18:41 UTC | |
|
Re^3: Getting srand's seed
by moritz (Cardinal) on Oct 10, 2008 at 06:22 UTC |