Tels wrote at Sat, 03 Aug 2002 00:25:54 +0200: > te@null:~> perl -e 'print rand(),"\n"' > 0.159625336368666 > te@null:~> perl -e 'print rand(),"\n"' > 0.292230773325176 > te@null:~> perl -e 'print rand(),"\n"' > 0.708889858870865 > te@null:~> > > This means perl does something like srand(rand()) for you automatically.
I knew. I wanted to impress that now "randomizing" is on. It was more a style of commenting. However, you're right, it's confusing. > I would suggest that Test::ManyParams leaves srand() alone, unless the user > want's a specific seed: > > use Test::ManyParams; # 1 nothing or like case 2 > use Test::ManyParams seed; # 2 seed = srand(rand()) done by T::MP > use Test::ManyParams seed => 5; # 3 srand(5) That reads really good, especially when written as Test::ManyParams seed => undef; :-) > seed or randomized are both good, I like the shorter one ;) You can take > your pick. Yep. I'll implement both (as synonyms). 'seed' is short and 'randomized' describes what it's talking about. > A nice idea is to make the choosen seed available via > > print "$Test::ManyParams::seed\n"; ACK. But now, when I read the idea, I have to think to the possible scenario, that a test scripts uses another test script and both are using Test::ManyParams with an own seeding could destroy a bit the concept. So, the seed and used random numbers should depend on the callers filename and package. Could be that $Test::ManyParams::seed becomes a tied variable, as I wouldn't like to write a method 'seed' :-). > although strictly that should not be necc, since surely T::MP will print it > for the testsuite? (Also, I don't know how to find out the seed for the case > 1, so probaböy case 1 and 2 should do the same and just do a > seed = srand(rand()). > > (I did not quite understand your srand(0) or srand(42) example...what is > that supposed to accomplish?) I first thought - now I've changed, that the default behaviour should be a fixed seed. As it wouldn't play any important role what fixed seed is taken, I imagined the canonical 0 or even the sense of life :-) Thanks a lot, Cheerio, Janek