Berkeley CSUA MOTD:Entry 13552
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/05/25 [General] UID:1000 Activity:popular
5/25    

1998/1/23 [Computer/SW/Languages/Perl] UID:13552 Activity:kinda low
1/21    What is a good random seed function using time and $$ in Perl?
        \_ One use might be to create filenames for temporary files. --dim
        \_ a silly first try might be
                my $filename =  $$. time;
        \_ No you stupid! I want to use srand() with a good seed. SHEESH.
           \_ As of perl 5.004, you don't have to call srand at all; see
              "perldoc -f srand" for details.  If you want a better random
              number generator, look at Math::TrulyRandom or /dev/random.
           \_ hahahah.   maybe you should rtfm, state your problem more
              clearly, and see Math::TrulyRandom on CPAN, Einstein.
        \_ srand(time % $$);
           \_ (time % $$) does not generate good random numbers.