ID : 240
Rnd
Function
To return a random number over 0 and below 1.
Syntax
Rnd[(formula)]
Guaranteed entry
- Formula
- This is an optional value. Designate any single precision real number type data.
Return value
Return a value within the range over 0 and below 1.
Description
Processing described in the table below is performed according to formula value.
Value in formula | Processing |
---|---|
< 0 | The same numeric value determined by seed value of argument formula is always returned. |
> 0 | The next random number in the random number sequence is returned. |
= 0 | A random number generated at the last minute is returned. If no random number is generated after power-up of the robot controller, 0 is returned. |
Omitted | The next random number in the random number sequence is returned. |
Related Terms
Attention
Unless the initial seed value is changed, the random number sequence returned by a set of Rnd functions is the same.
Example
'!TITLE "Generating Random Number Over 0 and Below 1"
' Generate one random number and store it to aaa
Sub Sample_Rnd
Dim aaa As Single
Randomize
' Acquisition of random number
aaa = Rnd
' Display a random number on the message output window
PrintDbg aaa
End Sub
ID : 240