[chuck-users] easy random numbers

Scott Wheeler wheeler at kde.org
Tue Nov 20 17:57:59 EST 2007

jakob kaiser wrote:
>     Hi!
>     Thanks for all your tips. I'll now try it with the sample value of
>     the time between the code is starting and the moment when the user
>     presses the first key. I guess that should be random enough.
>     But, yeah, I agree with Kassen that a function to read the
>     computer time should be included in one of the next releases. It
>     would be much more elegant with that. And of course I am looking
>     forward to the ChucKoo clock...

Uhm, I still don't get it.  I tried your example on two platforms 
yesterday (Mac and Windows -- my Linux machine is 64-bit) and the 
numbers are random -- with the exception of the first one (which you can 
get around by just having an extra, unused "Std.rand();" in your 
code.).  Why would you go to all that trouble?

Even if you did have the time in there you'd still have the same 
problem.  Std.srand() just calls the C srand() function and it's already 
called with the system time when ChucK is initializing...


More information about the chuck-users mailing list