Tks; Didn't realize I was calling randow_new repeatedly instead of only once :

 var r = make_rnd();


----- Original Message ----- From: "Nicolas Cannasse" <[EMAIL PROTECTED]>
To: "Neko intermediate language mailing list" <[email protected]>
Sent: Wednesday, March 28, 2007 2:26 AM
Subject: Re: [Neko] Generating random values


Hi

I want to fill the array with random values from 0 to 1000, but not sure
what I'am making wrong with the std libs :

First, you don't need to use set_seed, it's done automaticaly.
Then a more readable example would be :

var values = $amake(5000);
var i = 0;
var make_rnd = $loader.loadprim("[EMAIL PROTECTED]",0);
var rint = $loader.loadprim("[EMAIL PROTECTED]",2);
var r = make_rnd();

while( i < 5000 ) {
   values[i] = rint(r,1000);
   i += 1;
}

$print(values);


--
Neko : One VM to run them all
(http://nekovm.org)

Reply via email to