Difference between revisions of "LlFrand"
Jump to navigation
Jump to search
(Example shows how to use llFrand to simulate tossing a fair coin.) |
m (Changed template to LSL_Function and added sort=Frand) |
||
Line 1: | Line 1: | ||
{{ | {{LSL_Function | ||
|sort=Frand | |||
|func=llFrand | |func=llFrand | ||
|func_id=8 | |func_id=8 |
Revision as of 07:08, 28 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 random and in the range [0.0,mag) or (mag, 0.0].
• float | mag | – | Any valid float value |
Specification
returns 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>