My script is returning random values from Random Uniform(), until I write some results to a data table. When I write to the table Random Uniform() always returns the same value. See comments in script below. Would appreciate any help.
Many thanks,
John
names default to here(1);
clear log();
include("defineVectorClass.jsl");
dtChaos = open("chaos.jmp");
proportionToCorner = 0.5;
A = new object(Vector(column(dtChaos,"x")[1],column(dtChaos,"y")[1]));
B = new object(Vector(column(dtChaos,"x")[2],column(dtChaos,"y")[2]));
C = new object(Vector(column(dtChaos,"x")[3],column(dtChaos,"y")[3]));
triangle = {A,B,C};
dtChaos<<Graph Builder(
Size( 534, 454 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables( X( :X ), Y( :Y ) ),
Elements( Points( X, Y, Legend( 3 ) ) )
);
current = new object(Vector(column(dtChaos,"x")[4],column(dtChaos,"y")[4]));
wait(2);
for(i=1,i<1000,i++,
bill = Random Uniform( 0, 3 );//this is where I am generating random value
show(randomuniform());
show(bill);
corner = triangle[Ceiling( bill )];
show(corner);
cornerTemp = corner<<clone;
show(cornerTemp);
currentTemp = current<<clone;
show(currentTemp);
cornerTemp:sub(currentTemp);
show(cornerTemp);
cornerTemp:mult(proportionToCorner);
show(cornerTemp);
current:add(cornerTemp);
show(current);
newX = current:x;
newY = current:y;
column(dtChaos,"X")[1+4]=newX;//the values generated above are random
column(dtChaos,"Y")[1+4]=newY;//unless these two lines are uncommented, then I get the same value from random uniform()
wait(2);
);