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

Dar Scott dsc at swcp.com
Thu Jun 8 15:14:21 EDT 2006


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
   put empty into field "field"
   repeat with n = 10 to 35

     set the randomSeed to n
     put "0,0,0" into counters1
     get random(3)
     add 1 to item it of counters1

     set the randomSeed to n
     put "0,0,0" into counters2
     add 1 to item random(3) of counters2

     if counters1 is not counters2 then
     put n & tab & counters1 & tab & counters2 & lf after field "field"
     set the scroll of field "field" to 100000
   end if

   end repeat
end mouseUp

==>

11	0,0,1	0,1,0
12	0,1,0	1,0,0
13	0,1,0	0,0,1
18	0,0,1	0,1,0
19	0,0,1	1,0,0
20	0,1,0	0,0,1
23	1,0,0	0,0,1
24	1,0,0	0,1,0
25	0,0,1	0,1,0
26	0,0,1	1,0,0
29	0,1,0	1,0,0
30	1,0,0	0,0,1
31	1,0,0	0,1,0
33	0,0,1	1,0,0

This repeats with the same result every time (I'm setting randomSeed).

Rev 2.7.1 OS X 10.4.6

This looks a lot like the base64Decode bug that was fixed for 2.7.2.

Dar Scott



More information about the use-livecode mailing list