Profile
Best ForComments
Sat, 06/05/2010 - 07:42
#2
I made some changes
The random() function now works the same as the math.random() function in the standard lua library. In other words: random() returns a fraction between 0 and 1 you should call: randomseed(getseed()) once before calling any random() functions, as this will seed the random number generator from the current score. I removed all the comments from the random number generator itself (see the referenced site in the comments for a description of the algorithm). I added quite a bit a documentation about the functions themselves. If the foldit people ever give us access to the math standard library, you should be able to replace all calls to random() with math.random(), and randomseed() with math.randomseed(), and get the same functionality. You can then then remove the code given here.
Mon, 08/16/2010 - 01:24
#3
perhaps request as feature
I can see using this as a stopgap measure, but I think a RNG should be a basic functionality of the language. And definitely easy to implement as well.
Mon, 08/16/2010 - 15:35
#4
Just an idea but isn't
Just an idea but isn't seeding by the time more logical? that way the same score generates 'more' unique numbers every time. Include the date and the result is effectively unique every time. Did I miss something here? |
|
I had this idea to generate those numbers in a similar way.
Nice to see that there is already a script, so you saved some of my time and I don't need to reinvent the weel.
Thanks!