in reply to Re^2: Getting srand's seed
in thread Getting srand's seed
There are a number of really important things that you haven't told us. The most important pertains to the specific build of Perl that you are using because that influences the number of bits that rand uses for its seed. For standard Windows builds of Perl 2**15 values are all there are!
I suggested $seed = int(rand(2**31)); because most current Perl builds handle 32 bit integers without trouble and that would encompass the majority of seed sizes you are likely to encounter with standard builds of Perl. It also has the large advantage over using something like $seed = time ^ ($$ + ($$ << 15)); that the full entropy used to generate the "system" seed is retained.
We can't tell what you really want unless you tell us the nature of your application. If all you are doing is generating mazes for net hack then there really isn't an issue.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Getting srand's seed
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 |