recipe.GetRandomSeed() fail on windows

Case number:845813-992549
Topic:Game: Tools
Opened by:Rav3n_pl
Opened on:Tuesday, May 1, 2012 - 20:48
Last modified:Monday, August 27, 2012 - 19:57

Is ALWAYS 41 on windows!
On linux works ok.

(Tue, 05/01/2012 - 20:48  |  10 comments)

Joined: 09/27/2011

Same here (Win7_64).

brow42's picture
User offline. Last seen 2 weeks 4 days ago. Offline
Joined: 09/19/2011
Groups: None

OH I meant to feedback this, or add it to the running LUA2 bug list. I talked to Tlaloc...he meant for this to be an independent random series that you could use a s a seed (since the clock only changes once a second). He intended for THIS sequence to be seeded by the clock when you start foldit. Apparently, it's not getting seeded properly.

Until this gets fixed (and I don't think it's a high priority because there is a simple work around), just use the clock. I like to keep it human readable to 4 or 5 digits, I rarely (never) need more than 100 000 seeds. :)

N and N+1 *ARE* totally different random number sequences....but if it bugs you, you can multiply by a large prime. I use this in ZLB wiggle:

seed = (os.time() * 5779) % 10000
print('seed =', seed)

Joined: 09/21/2011
Groups: Void Crushers

Brow42, you must also skip the first "random" number from the math.random function. That one is not, after that math.random is oke.

Tlaloc's picture
User offline. Last seen 44 weeks 6 days ago. Offline
Joined: 08/04/2008
Groups: Mojo Risin'

Let me add why this is failing. I used the C++ random number generator to return the seed. At the time that I wrote it last summer, the C++ random number generator was being seeded with some clock value early in the run of foldit. Now it isn't, for some reason, which means that this is returning the same value every time.

You don't want to seed the C++ random number generator on each call, as that can actually return non-random want to only call it once, sometime at program start time. A simple:

srand ( time(NULL) );

somewhere at program run time should suffice.

Joined: 06/17/2010

I`m not 100% sure, but you says that only one randomseed is need?
No need to initialize generator in every script?

Tlaloc's picture
User offline. Last seen 44 weeks 6 days ago. Offline
Joined: 08/04/2008
Groups: Mojo Risin'

You will need to seed it each time the Lua runtime environment is fired up...if it shuts down it will need to be reseeded, and I think that happens at the beginning of each script run. I would seed a Lua script once at the start.

That message above was for Jeff, Seth, or Riley to fix the foldit code. It's a one-line fix for them...they just need to find the right place in the code to put it.

Joined: 06/17/2010

Best way to avoid it would be kill the seed command and seed it automagically when foldit is starting.

Joined: 09/21/2011
Groups: Void Crushers

But some people want to be able to set the seed themselves so they can reproduce a run.
Killing it totally is not an option for them.

Joined: 06/17/2010

Ahh, right :) I made one step too much :)

gramps's picture
User offline. Last seen 8 years 11 weeks ago. Offline
Joined: 12/16/2010



Developed by: UW Center for Game Science, UW Institute for Protein Design, Northeastern University, Vanderbilt University Meiler Lab, UC Davis
Supported by: DARPA, NSF, NIH, HHMI, Amazon, Microsoft, Adobe, Boehringer Ingelheim, RosettaCommons