Jump to content

Random Number Generator


---
 Share

Recommended Posts

Most likely random enough..
for i = 1 to 10
	//Official
	display("Method 1 -"+list(0, 1, 2, 3, 4, 5, 6, 7, 8, 9).shuffle.first)
	display("Method 2 -"+mid(millisecondClockValue().asString,12).asInteger)
	//Unofficial
	display("Method 3 -"+executeCode("LaggedFibonacciRandom new").seed)
next i
Link to comment
Share on other sites

Please sign in to view this quote.

Look who's doing a guest appearance. Nice to see you here again.
What does the ".seed"-thing do?

OnT: Depending on how big you want the random number to be. Something like this:
//Takes some random parameters that are very hard to predict and makes a string of their numerical hashes
LongStringOfNumbers = millisecondClockValue().asString.hash + getPositionCMM().x.asString.hash + getPositionCMM().y.asString.hash+ getPositionCMM().z.asString.hash

//converts the long string to a number
RandomHighValue = val(LongStringOfNumbers)

//If you want a random number between 1 and 100
RandomValueBetween = mod(RandomHighValue,100) +1 

There might be some errors in there. I'm not on the Calypso computer right now so I can't test it.
The good thing about using the actual position of the CMM is that it is like 6 decimals and it always drifts a little so it becomes extremely hard to predict and even harder to replicate.
Link to comment
Share on other sites

Use Result Elements.
Result Element1
millisecondClockvalue()

Result Element2
millisecondClockvalue()

Result Element3
Take the Absolute of Result Element1 - Result Element2
Modify as needed.
Link to comment
Share on other sites

 Share

×
×
  • Create New...