random number seed initialisation [message #87502] |
Sun, 09 February 2014 18:21  |
Matt Francis
Messages: 94 Registered: May 2010
|
Member |
|
|
I have a system that will be used by multiple users that, as a part of it, requires the creation of temporary files that I just give a random file name. I'm not sure how IDL goes about initialising the random seed if you don't supply it, so how can I ensure that different users running concurrently won't use the same initial seed and hence end up with the same file names?
|
|
|
|
|
Re: random number seed initialisation [message #87510 is a reply to message #87509] |
Mon, 10 February 2014 15:22   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Bogdanovist writes:
> Thanks David, using that keeps me safe within a single session (which I do already although not with as elegant a solution as this), but how does this ensure different seeds across different sessions/users?
The seed at object initialization is pretty damn, well..., random! The
number of seconds after January 1st, 1970 or some such thing. The chance
of a sequence repeating itself seems non-existent to me. I understand
you can purchase quantum random number generators that rely on the the
space vacuum for seed generation for only a couple hundred thousand
dollars. In other words, cheap if you need that sort of thing. ;-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
|
|
|
Re: random number seed initialisation [message #87514 is a reply to message #87512] |
Tue, 11 February 2014 07:22  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
>> But what if two users init within the same second (not outside the realm of possibility in my application)? I guess I could go to microseconds, that would probably do it.
>
> If you are running a relatively recent version of IDL, I really don't
> think you have to worry about this. They recently overhauled the way
> they generate the initial seed to make it more robust. You would have to
> ask the folks at ExelisVis, but if it were me, I could find a couple of
> hundred things more compelling to worry about, starting with high
> avalanche danger on my favorite skiing trails after a weekend of big
> snows.
I think I was a day early in my concerns. In my Feedly reading list this
morning:
http://www.brainpickings.org/index.php/2014/02/11/brockman-w hat-
should-we-be-worried-about/
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|