Student Support Forum: 'Random value in a unit circle' topicStudent Support Forum > General > "Random value in a unit circle"

 < Previous Comment Help | Reply To Comment | Reply To Topic
 Author Comment/Response Forum Moderator email me 09/21/07 06:52am In Response To 'Re: Re: Random value in a unit circle' --------- Your answer makes me wonder if I have lead you into a misunderstanding. There is not a general need to have multiple statements in a plot. The issue is that, as defined (and there is nothing wrong with how you did that), every time x and y are used/evaluated a new random number is generated. In your code when x^2 + y^2 < 1 is tested a random x (say .5) and a random y (say .2) are generated and the test is evaluated. With those values the test would be true. Then the If indicates that an {x,y} pair be created. At that point a new x and new y are generated which being random could be anything ({.9,.7}, {.2,.01}, ....) and as you saw are not limited by the squares less than 1 test. That is why the points were not limited to being inside the circle. By setting a = x and b = y and then testing a and b and creating {a,b} if the test is true, only one random x and y are created each time. That is, in the example above a would be the first value of x and b would be the first value of y and {a,b} would be {.5,.2}. Tom Zeller URL: ,

 Subject (listing for 'Random value in a unit circle') Author Date Posted Random value in a unit circle John 09/20/07 01:40am Re: Random value in a unit circle Forum Modera... 09/20/07 07:01am Re: Re: Random value in a unit circle John 09/20/07 11:33am Re: Re: Re: Random value in a unit circle Forum Modera... 09/21/07 06:52am
 < Previous Comment Help | Reply To Comment | Reply To Topic