comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » random number seed initialisation
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
random number seed initialisation [message #87502] Sun, 09 February 2014 18:21 Go to next message
Matt Francis is currently offline  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 #87504 is a reply to message #87502] Sun, 09 February 2014 18:37 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Bogdanovist writes:

> 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?

Use the RandomNumberGenerator object from the Coyote Library:

http://www.idlcoyote.com/programs/randomnumbergenerator__def ine.pro

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 #87509 is a reply to message #87504] Mon, 10 February 2014 15:11 Go to previous messageGo to next message
Matt Francis is currently offline  Matt Francis
Messages: 94
Registered: May 2010
Member
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?
Re: random number seed initialisation [message #87510 is a reply to message #87509] Mon, 10 February 2014 15:22 Go to previous messageGo to next message
David Fanning is currently offline  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 #87511 is a reply to message #87510] Mon, 10 February 2014 15:32 Go to previous messageGo to next message
Matt Francis is currently offline  Matt Francis
Messages: 94
Registered: May 2010
Member
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.
Re: random number seed initialisation [message #87512 is a reply to message #87511] Mon, 10 February 2014 15:42 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Bogdanovist 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.

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 #87513 is a reply to message #87502] Tue, 11 February 2014 01:34 Go to previous messageGo to next message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
Den måndagen den 10:e februari 2014 kl. 03:21:38 UTC+1 skrev Bogdanovist:
> 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?

If you are on a unix-like system, you could spawn a call to mktemp.
Re: random number seed initialisation [message #87514 is a reply to message #87512] Tue, 11 February 2014 07:22 Go to previous message
David Fanning is currently offline  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.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: correlation coefficient and confidence level
Next Topic: gaussian grid

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 11:36:34 PDT 2025

Total time taken to generate the page: 0.00504 seconds