[chuck-users] Non-random random number

David Loberg Code d.loberg.code at wmich.edu
Wed Oct 9 12:59:51 EDT 2013

Forgive me if this was already discussed on the list before.  I am puzzled about a non-random random number.
When the random number is calculated right after an STK instrument is declared, the result is not random.  It is the same number every time.
However, if the same code occurs without an STK declaration before it, the result is random.

while (true)
StifKarp stu => dac;
int randy;
Std.rand2(0,10) => randy;
<<<"here are three random numbers",
Std.rand2(0,10), Std.rand2(0,10),Std.rand2(0,10),
"and NON-random Randy", randy >>>;

Std.rand2(0,10) => randy;
<<<"here are three more random numbers",
Std.rand2(0,10), Std.rand2(0,10),Std.rand2(0,10),
"and random Randy", randy >>>;
1000::ms => now;


David Loberg Code
School of Music
Western Michigan University
1903 W Michigan Ave
Kalamazoo, MI 49008-5434
code at wmich.edu

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

More information about the chuck-users mailing list