randomnumber / randomseed
Dar Scott
dsc at swcp.com
Wed Jul 30 19:51:00 EDT 2003
On Wednesday, July 30, 2003, at 05:43 PM, Michael wrote:
> put random 100000 into x
> set the randomseed to x
> get random(whatever)
Getting some randomness into the randomSeed it a good idea. Is that
what this is about? I don't think this will do it, though.
This script will always product the same result on my Revolution 2.0.1
on OS X:
on mouseUp
put empty into field "Report"
set the randomSeed to 1
put random(5) & LF after field "Report"
put random(29) & LF after field "Report"
set the randomSeed to random(100000)
put random(9) & LF after field "Report"
put random(100) & LF after field "Report"
end mouseUp
Fortunately, Revolution does set the seed to a different number each
time the engine starts up (almost). I suspect two standalones starting
at about the same time might start out with the same randomSeed. It
looks like seconds plus a birthday code. It might be more complicated
and I don't see the pattern.
Here is where Revolution shines. How to get randomness to put into a
randomSeed or to update a temporary randomSeed? I suspect that a cool
solution exists using front scripts that grab some time bits for mouse
and key actions. There are lots of bits available on OS X and a few on
Windows, but I suspect you may have to get them one at a time on Mac OS
9 and Linux.
Dar Scott
************************************************************************
****
Dar Scott Consulting http://www.swcp.com/dsc/ Programming
Services
************************************************************************
****
More information about the use-livecode
mailing list