<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Random Uniform() keeps giving me the same number in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Random-Uniform-keeps-giving-me-the-same-number/m-p/189066#M40772</link>
    <description>&lt;P&gt;(Thanks&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/11257"&gt;@EvanMcCorkle&lt;/a&gt;&amp;nbsp; and&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4587"&gt;@danschikore&lt;/a&gt;&amp;nbsp; for puzzling this out before I got in this morning!)&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Use color rather than label" style="width: 549px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/16632iCE77826C983AF460/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Use color rather than label" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Use color rather than label&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another approach that keeps the labels needs a workaround in your JSL:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;	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);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;this captures and restores t&lt;SPAN style="font-family: inherit;"&gt;he random state before&amp;nbsp;and after the markers are drawn. The combination of changing a value in the table and the wait triggers the graph to update.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;Thanks for the test case; a proper fix is underway.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Mar 2019 14:52:03 GMT</pubDate>
    <dc:creator>Craige_Hales</dc:creator>
    <dc:date>2019-03-25T14:52:03Z</dc:date>
    <item>
      <title>Random Uniform() keeps giving me the same number</title>
      <link>https://community.jmp.com/t5/Discussions/Random-Uniform-keeps-giving-me-the-same-number/m-p/189009#M40764</link>
      <description>&lt;P&gt;My script is returning random values from Random Uniform(), until I write some results to a data table.&amp;nbsp; When I write to the table Random Uniform() always returns the same value.&amp;nbsp; &amp;nbsp;See comments in script below.&amp;nbsp; Would appreciate any help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;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&amp;lt;&amp;lt;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&amp;lt;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&amp;lt;&amp;lt;clone;
	show(cornerTemp);
	currentTemp = current&amp;lt;&amp;lt;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);
	
	
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 24 Mar 2019 13:16:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-Uniform-keeps-giving-me-the-same-number/m-p/189009#M40764</guid>
      <dc:creator>johnmoore</dc:creator>
      <dc:date>2019-03-24T13:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: Random Uniform() keeps giving me the same number</title>
      <link>https://community.jmp.com/t5/Discussions/Random-Uniform-keeps-giving-me-the-same-number/m-p/189037#M40765</link>
      <description>&lt;P&gt;I see the issue, don't know the answer yet.&lt;/P&gt;
&lt;P&gt;I'll look at it monday morning.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/11257"&gt;@EvanMcCorkle&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2019 00:55:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-Uniform-keeps-giving-me-the-same-number/m-p/189037#M40765</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2019-03-25T00:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: Random Uniform() keeps giving me the same number</title>
      <link>https://community.jmp.com/t5/Discussions/Random-Uniform-keeps-giving-me-the-same-number/m-p/189066#M40772</link>
      <description>&lt;P&gt;(Thanks&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/11257"&gt;@EvanMcCorkle&lt;/a&gt;&amp;nbsp; and&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4587"&gt;@danschikore&lt;/a&gt;&amp;nbsp; for puzzling this out before I got in this morning!)&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Use color rather than label" style="width: 549px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/16632iCE77826C983AF460/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Use color rather than label" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Use color rather than label&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another approach that keeps the labels needs a workaround in your JSL:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;	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);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;this captures and restores t&lt;SPAN style="font-family: inherit;"&gt;he random state before&amp;nbsp;and after the markers are drawn. The combination of changing a value in the table and the wait triggers the graph to update.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;Thanks for the test case; a proper fix is underway.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2019 14:52:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-Uniform-keeps-giving-me-the-same-number/m-p/189066#M40772</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2019-03-25T14:52:03Z</dc:date>
    </item>
    <item>
      <title>Re: Random Uniform() keeps giving me the same number</title>
      <link>https://community.jmp.com/t5/Discussions/Random-Uniform-keeps-giving-me-the-same-number/m-p/189552#M40802</link>
      <description>&lt;P&gt;Another 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.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2019 14:20:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-Uniform-keeps-giving-me-the-same-number/m-p/189552#M40802</guid>
      <dc:creator>XanGregg</dc:creator>
      <dc:date>2019-03-26T14:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: Random Uniform() keeps giving me the same number</title>
      <link>https://community.jmp.com/t5/Discussions/Random-Uniform-keeps-giving-me-the-same-number/m-p/189701#M40832</link>
      <description>&lt;P&gt;Thanks for the quick response.&amp;nbsp; Labels were not important for the simulation so I just turned them off like you suggested and everything is working great.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2019 13:50:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-Uniform-keeps-giving-me-the-same-number/m-p/189701#M40832</guid>
      <dc:creator>johnmoore</dc:creator>
      <dc:date>2019-03-27T13:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Random Uniform() keeps giving me the same number</title>
      <link>https://community.jmp.com/t5/Discussions/Random-Uniform-keeps-giving-me-the-same-number/m-p/189702#M40833</link>
      <description>&lt;P&gt;Thanks Xan&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2019 13:51:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Random-Uniform-keeps-giving-me-the-same-number/m-p/189702#M40833</guid>
      <dc:creator>johnmoore</dc:creator>
      <dc:date>2019-03-27T13:51:47Z</dc:date>
    </item>
  </channel>
</rss>

