Submitted by dparks on Thu, 2008-09-25 04:59
Hello,
I am using frams to run a number of experiments. Unfortunately, the results are deterministic (i.e., I get the same results every time). I am using the following to run the experiment:
frams "lo baseline_params.expt" "st 100000000" "sa baseline3.expt" "qu"
It would appear I need some way to seed a random number generator. How do I do this? Much thanks!
Cheers,
Donovan
Forums:
Include this before
Hello Maciej, I'm not sure
Hello Maciej,
I'm not sure exactly what you mean here. When I try:
frams "lo baseline_params.expt" "Math.seed=(Math.time%10000)*100" "st 10000" "sa baseline2.expt" "qu"
I get the following error:
[ERROR] FramScriptCompiler::compile - compile error in command line input near line 1: parse error
I'd really like to be able to run it from the command line. Any suggestions?
Thanks,
Donovan
Missing semicolon at the end
Missing semicolon at the end of
Math.seed=(Math.time%10000)*100
?Hi, adding
Hi, adding "Math.seed=Math.time*100;" doesn't fix the seed issue. I get exactly the same results. This is my command line:
./frams.linux "lo basicquad.gen" "im evol.smooth.sim" "Math.seed=Math.time*100;" "st 100000000" "sa baseline2.end.expt" "im eval.smooth.sim" "Math.seed=Math.time*100;" "st 10000000" "sa baseline2.eval.smooth.expt" "qu"
Yes... I have updated
Yes... I have updated previous posts in this thread.
Since
Math.seed
is a 32-bit integer, you should first cut off the "big number" part from Math.time, otherwise it will overflow the int32 range.So better use
Math.seed=(Math.time%100000)*1000;
or similar.Note that the
rnd
macro fromcliutils.ini
does what you need, as shown in the example below.frams -icliutils.ini "rnd" "Simulator.print(Math.rnd01);" -q