[chuck-users] random seed

Kassen signal.automatique at gmail.com
Sat Sep 11 11:58:23 EDT 2010

Hey, Lars!

I'm not Stephan, but I'm still a bit confused as well so I thought I'd
answer anyway.

Std.srand(1200); //set your seed

Looks fine

    <<<"--------------", "we always get the same numbers" >>>;

That's what we'd expect, yes.

> Hope this helps!
>  Well.... no, not really.

What happens if you don't set the seed with srand(), do you still get the
same numbers? As I understand things now you should get exactly what you are
looking for by simply not setting the seed in line 1. Could you verify that
by not setting the seed at all you get different numbers each time you run
your program? If not we have a bug. I seem to remember there was a issue
like that on Windows, which might be caused by Windows (last time I looked)
not having the "storage" of OS-event based random numbers that Unix
typically uses; that might be the cause. That's no excuse though; as we are
not trying to secure nuclear missiles (I hope!) something like the time in
ms should yield a perfectly serviceable seed at VM startup.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20100911/83cf94c6/attachment-0001.html>

More information about the chuck-users mailing list