Random Uniform() keeps giving me the same numberMy 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=""></GRAPH>Re: Random Uniform() keeps giving me the same numberThanks Xan
Re: Random Uniform() keeps giving me the same numberThanks for the quick response. Labels were not important for the simulation so I just turned them off like you suggested and everything is working great.
Re: Random Uniform() keeps giving me the same numberAnother work-around is to turn off the Hide Overlapping Labels preference in the Graphs preferences group. That appears to be the source of the inteference with the random stream.
Re: Random Uniform() keeps giving me the same number(Thanks @EvanMcCorkle and @danschikore for puzzling this out before I got in this morning!)
It is a bug in JMP's marker drawing; the easiest way to get your JSL going is to remove the Label state and change it to a color.
Use color rather than labelUse color rather than labelUse color rather than label
The problem is with the code that is positioning the labels around the data points; it needs a repeatable sequence of random numbers to juggle colliding labels, but it isn't keeping the reset to itself...as you noticed.
Another approach that keeps the labels needs a workaround in your JSL:
r = Random Seed State(); // the following statements make the graph update...
newX = current:x;
newY = current:y;
column(dtChaos,"X")[1+4]=newX;
column(dtChaos,"Y")[1+4]=newY;
wait(2);
Random Seed State(r);
this captures and restores the random state before and after the markers are drawn. The combination of changing a value in the table and the wait triggers the graph to update.
Thanks for the test case; a proper fix is underway.
Re: Random Uniform() keeps giving me the same numberI see the issue, don't know the answer yet.
I'll look at it monday morning.
@EvanMcCorkle