Cliff Bergman on Tue, 29 Jun 2004 20:02:45 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: seed for random()


Thanks. 'setrand' is what I was looking for. Perhaps it could be mentioned in the documentation entry for the random function?

--cb

--On Tuesday, June 29, 2004 12:35:40 PM -0400 Igor Schein <igor@txc.com> wrote:

> Here's an idea - add the following line in you .gprc:
>
> read "$HOME/.gpsetrand"
>
> Then create a file $HOME/.gpsetrand containing the following line:
>
> setrand(extern("date +%s"))
>
> I am implicitely assuming GNU date command availability, otherwise you
> need to use some other Unix command which will give you a unique
> number every time, e.g. reading from /dev/random if available, etc.



Cliff Bergman
Department of Mathematics
Iowa State University
Ames, Iowa 50011