[chuck-users] random seed

Lars Ullrich mail at larsullrich.de
Sat Sep 11 11:32:19 EDT 2010


Hi Stefan,

I like to use a seed in many tasks, specialy for sequencing.

Maybe this example helps you to understand what I mean:

Std.srand(1200); //set your seed
int SeedArray[8];

//fill your array with random numbers
fun void CalcRndArray()
{
     for(int i; i < SeedArray.cap(); i++)
     {
         Std.rand2( 1 , 1000 )=>SeedArray[i];
     }
} CalcRndArray();

while (1)
{
     for(int i; i < SeedArray.cap(); i++)
     {
         <<<SeedArray[i]>>>;
     }
     <<<"--------------", "we always get the same numbers" >>>;
     2::second=>now;

}

// image reading your arrays randomly, but with a repeating structure.

// if you want another structure, just change the seed. in that case  
the seed will be your pattern

// and if you don't want a structure, leave the seed or change it with  
a function.



Hope this helps!

Lars







Am 11.09.2010 um 15:46 schrieb Stefan Blixt:

> This thread has made me thoroughly confused. I see that you have  
> solved your issue, Lars, but I would still like to know what your  
> task was. :) I feel it might be good for inspiration.
>
> In my world of computer science, if you use a random generator,  
> pretend that you've never heard the word "seed", and just start  
> reading random numbers, you will effectively get non repeatable  
> structures, different every time.
>
> /Stefan
>
> 2010/9/11 Kassen <signal.automatique at gmail.com>
>
>
> On 11 September 2010 15:31, Lars Ullrich <mail at larsullrich.de> wrote:
>  Hi Kas,
>
> Hey, Lars!
>
> I was looking for a message to turn off the seed. Something like  
> "set seed to 0" and get non repeatable structures. (like maxmsp  
> object lp.tata from peter castine )
>
> The default situation should be getting a initial seed from the host  
> OS when the VM starts. That seed should be unknown to you, but it's  
> still a seed. There really is no way to "turn off the seed" with  
> PRNG's. Sorry; it's not my fault ;¬).
>
>
>
> Anyway, I have found a method to do this with some functions.
>
> Thanks a lot for your patience.
>
> No problem, that's what the list is for,
>
> Yours,
> Kas.
>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
>
>
>
> -- 
> Release me, insect, or I will destroy the Cosmos!
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users

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


More information about the chuck-users mailing list