Difference between revisions of "LlFrand"
Jump to navigation
Jump to search
m (Changed template to LSL_Function and added sort=Frand) |
|||
Line 9: | Line 9: | ||
|p1_desc=Any valid float value | |p1_desc=Any valid float value | ||
|return_type=float | |return_type=float | ||
|return_text=that is random | |return_text=that is pseudo random number in the range [0.0,mag) or (mag, 0.0]. | ||
|spec=returns random number in range [0.0, mag) or (mag, 0.0] | |spec=returns a pseudo random number in range [0.0, mag) or (mag, 0.0], depending upon the sign of mag. | ||
|caveats | |caveats | ||
|examples= | |examples= | ||
Line 30: | Line 30: | ||
|func_helpers | |func_helpers | ||
|also | |also | ||
|notes | |notes= | ||
The random number generator is not a reliable source of entropy. | |||
The sequence of random numbers are shared across the entire process, and not independently seeded. Therefore, the pseudo random number generation is not suitable for any application which requires completely predictable or completely unpredictable results. | |||
}} | }} | ||
[[Category:LSL_Functions]] | [[Category:LSL_Functions]] | ||
[[Category:LSL_Math]] | [[Category:LSL_Math]] |
Revision as of 16:35, 31 January 2007
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: float llFrand( float mag );8 | Function ID |
0.0 | Forced Delay |
10.0 | Energy |
Returns a float that is pseudo random number in the range [0.0,mag) or (mag, 0.0].
• float | mag | – | Any valid float value |
Specification
returns a pseudo random number in range [0.0, mag) or (mag, 0.0], depending upon the sign of mag.
Caveats
Examples
<lsl> default {
touch_start(integer total_number) { // When touched, say "Heads" with probability 0.5, // otherwise, say "Tails." if ( llFrand(1.) < .5) llSay(0, "Heads"); else llSay(0, "Tails"); }
}
</lsl>Notes
The random number generator is not a reliable source of entropy.
The sequence of random numbers are shared across the entire process, and not independently seeded. Therefore, the pseudo random number generation is not suitable for any application which requires completely predictable or completely unpredictable results.