[chuck-users] easy random numbers

jakob kaiser jakobala at hotmail.com
Mon Nov 19 13:26:56 EST 2007


Hi,
I want to write a small script for ear training with Chuck. Therefore Chuck should produce values that seem to be quite random. But it seems like that the standard functions here are too deterministic. I know that a non-deterministic random function would not be possible, but most programming languages provide functions that create at least new numbers every time I start the same code. However, in chuck something like the following always prints the same numbers when I run it:
 
while(true){   1::second => now;   Math.rand2(50, 1000) => int rndNumber;   <<<rndNumber>>>;} 
 
Is there an easy way to get something more unpredictable? I don't want to go deep into random generator programming. But the function does not really what you would expect of a random generator, does it? 
 
Cheers
 
Jakob
_________________________________________________________________
Connect to the next generation of MSN Messenger 
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20071119/75377e9e/attachment.htm 


More information about the chuck-users mailing list