Re: randomizing trouble
- From: gazelle@xxxxxxxxxxxxxxxxxx (Kenny McCormack)
- Date: Tue, 9 Jun 2009 20:31:21 +0000 (UTC)
In article <7vzXl.1624$u86.17@xxxxxxxxxxxxxxxxxxxx>, Ben <abc@xxxxxxx> wrote:
I have a gawk script that puts random comments into a file. It is run 3
times in a row in quick succession. I found that seeding the random
number generator using gawk did not work because all 3 times it was run
was done within the same second (and it uses the time) - so I decided to
When last I ran into this problem, what I did was to save the last value
returned by rand() to a file, then on the next run, read that in and use
that value as the arg to srand(). Worked well.
Note: You may have to multiply the value by something like 32000 since
rand() returns a small decimal and srand() takes an integer. Anyway,
you get the idea...
.
- Follow-Ups:
- Re: randomizing trouble
- From: Aharon Robbins
- Re: randomizing trouble
- References:
- randomizing trouble
- From: Ben
- randomizing trouble
- Prev by Date: randomizing trouble
- Next by Date: Re: GAWK fatal error if input file is a directory
- Previous by thread: randomizing trouble
- Next by thread: Re: randomizing trouble
- Index(es):
Relevant Pages
|