Difference between revisions of "Random"
From Xojo Documentation
(→Sample Code) 

Line 16:  Line 16:  
{{Method  name=LessThan  params=Range as [[Integer]]  returntype=[[Integer]]  description=LessThan(Range as Integer) as Integer
Returns a random number as an Integer in the range greater than or equal to 0 and less than Range1 }}  {{Method  name=LessThan  params=Range as [[Integer]]  returntype=[[Integer]]  description=LessThan(Range as Integer) as Integer
Returns a random number as an Integer in the range greater than or equal to 0 and less than Range1 }}  
{{Method  name=Number  returntype=[[Double]]  description=Number() as Double
Returns a random number as a Double in the range greater than or equal to 0 and less than 1. }}  {{Method  name=Number  returntype=[[Double]]  description=Number() as Double
Returns a random number as a Double in the range greater than or equal to 0 and less than 1. }}  
−  {{Method  name=RandomizeSeed  description=Changes the random objects seed value to start a new sequence of pseudo random numbers.}}  +  {{Method  name=RandomizeSeed  description= RandomizeSeed()
Changes the random objects seed value to start a new sequence of pseudo random numbers.}} 
</dynamicTable>  </dynamicTable>  
Latest revision as of 18:08, 10 March 2021
Used to generate random numbers.
Properties  

Methods  

Notes
Use System.Random to create an instance of this class.
The Random class supersedes the Rnd function. It performs the same functions and more.
A custom random number generator is used. For best results, you should only create a single instance of Random per app.
The Random class's seed is used to initialize the pseudorandom number generator's algorithm so that you can always get the same stream of numbers from the same seed. However, this is not an endianindependent operation. If you set the seed on a bigendian machine to the same value that you used on a littleendian machine, you will get two different streams of pseudorandom numbers.
Sample Code
Use System.Random to get an instance of the class:
See Also
Rnd, System.Random functions