Re: item random() (was Random(3) often returns 1)

2006-06-09 Thread Rob Cozens
Geoff, et al: Even stranger, making this slight adjustment fixes it: on mouseUp repeat 1000 put random(3) into z add 1 to x[z] There is something problematic involved in referencing a function result as a variable inline in a statement. I have encountered instances in other

Re: item random() (was Random(3) often returns 1)

2006-06-09 Thread Rob Cozens
Moi: add 1 to x[value(random(3)) Forgot trailing ] add 1 to x[(value(random(3))) Forgot trailing ] add 1 to item (random(3)) of myCounter] There it iswhere it shouldn't be. :{`) Rob Cozens CCW, Serendipity Software Company And I,

Random(3) often returns 1

2006-06-08 Thread Thomas McCarthy
Has anyone noticed this? I have two games that sort a container (three lines, one line is the answer) by random the number of lines. The answer should be in any one of the three resulting lines, but is overwhelmingly in the first any thoughts? tm

Re: Random(3) often returns 1

2006-06-08 Thread Sarah Reichelt
On 6/8/06, Thomas McCarthy [EMAIL PROTECTED] wrote: Has anyone noticed this? I have two games that sort a container (three lines, one line is the answer) by random the number of lines. The answer should be in any one of the three resulting lines, but is overwhelmingly in the first I think

Re: Random(3) often returns 1

2006-06-08 Thread Mark Schonewille
Hello, I think Sarah is right, lines may end up with equal random numbers. However, my test results show another weird phenomenon. on mouseUp put 0,0,0 into myCounter repeat 10 repeat 1000 add 1 to item random(3) of myCounter end repeat put myCounter sum(myCounter)

Re: Random(3) often returns 1

2006-06-08 Thread Jim Ault
Perhaps the definition of random(3) is more like generate a random number precisely round the result to a non-zero integer (or truncate the result to a non-zero integer) show the result of this process. One could try (random(2999) div 1000)+1 I think the basic problem is begins by

Re: Random(3) often returns 1

2006-06-08 Thread Rob Cozens
Hi Tom, I have two games that sort a container (three lines, one line is the answer) by random the number of lines. The answer should be in any one of the three resulting lines, but is overwhelmingly in the first any thoughts? The smaller the root of a random number, the greater (a) the

Re: Random(3) often returns 1

2006-06-08 Thread Mark Smith
Wow. I ammended your handler like this: on mouseUp repeat 10 put 0,0,0 into myCounter repeat 1000 add 1 to c add 1 to item random(3) of myCounter put myCounter cr after cList end repeat put myCounter sum(myCounter) return after myList end repeat put c

Re: Random(3) often returns 1

2006-06-08 Thread Dar Scott
On Jun 8, 2006, at 7:00 AM, Sarah Reichelt wrote: I think if you sort using only the number of lines as your randomiser, you will get some lines with the same sort value and so their order will remain the same. When doing this type of sort, I alwasy got for a ridiculously large randome number

item random() (was Random(3) often returns 1)

2006-06-08 Thread Dar Scott
On Jun 8, 2006, at 11:05 AM, Mark Smith wrote: 341,344,345 1030 328,326,329 983 348,346,347 1041 331,334,335 1000 321,323,322 966 337,340,339 1016 317,318,316 951 310,308,309 927 345,345,346 1036 352,355,350 1057 not at all as expected My variation: on mouseUp set the cursor to watch

Re: item random() (was Random(3) often returns 1)

2006-06-08 Thread Mark Schonewille
Hi Dar, Rev 2.7.2 gives exactly the same results. Best, Mark -- Economy-x-Talk Consultancy and Software Engineering http://economy-x-talk.com http://www.salery.biz Download ErrorLib at http://economy-x-talk.com/developers.html and get full control of error handling in Revolution. Op

Re: item random() (was Random(3) often returns 1)

2006-06-08 Thread Geoff Canyon
I just ran this code on mouseUp repeat 1000 add 1 to x[random(3)] end repeat put sum(x) into y combine x using cr and tab put x cr cr y end mouseUp and got this: 1 329 2 328 3 328 985 Note that the three numbers don't add up to 1000, but there are no

Re: item random() (was Random(3) often returns 1)

2006-06-08 Thread Mark Schonewille
Hi Geoff, Funny, that's exactly what I demonstrated in a previous e-mail, earlier to/yesterday. Apparently, there is more than one workaround. Maybe a slight pause is all it takes. Best, Mark -- Economy-x-Talk Consultancy and Software Engineering http://economy-x-talk.com

Re: item random() (was Random(3) often returns 1)

2006-06-08 Thread Geoff Canyon
On Jun 8, 2006, at 4:59 PM, Mark Schonewille wrote: Funny, that's exactly what I demonstrated in a previous e-mail, earlier to/yesterday. Apparently, there is more than one workaround. Maybe a slight pause is all it takes. Looking back I see that -- apparently I didn't read the previous

Re: item random() (was Random(3) often returns 1)

2006-06-08 Thread Mark Smith
I tried putting a 'wait 1 millsecond' into the loop, and it made no difference. Perhaps there is something weird about what the random() function returns, until it is put into a variable? Mark On 9 Jun 2006, at 00:59, Mark Schonewille wrote: Maybe a slight pause is all it takes.