I have a plot of a function that uses rand(0)
to generate numbers between 0 and 1.
I would like to set a different random sequence each time I run the Gnuplot script.
The documentation says to uses rand(x)
where x
is a positive integer.
I have tried this
rand(floor(10*acos(rand(0))))
that gives an integer for each execution.
However, this line gives me an error. I have not found any example of setting the seed of rand
.
How can I set a different seed each time to get different plots?
Regards
If you want seemingly different set of random numbers each time gnuplot starts up you can seed the random number generator with the time(0) function. Use:
rand(time(0))
the first time to get it going. Then just use rand(0) for the rest in your script.