# Difference between revisions of "random"

Jump to navigation
Jump to search

Line 1: | Line 1: | ||

+ | back to [[Scripting_Reference#R|COMREF]] | ||

+ | |||

<h2 style="color:#000066">'''random ''x'''''</h2> | <h2 style="color:#000066">'''random ''x'''''</h2> | ||

+ | |||

'''Operand types:''' | '''Operand types:''' | ||

− | x: [[Number]] | + | '''x:''' [[Number]] |

'''Type of returned value:''' | '''Type of returned value:''' | ||

− | Number | + | [[Number]] |

'''Description:''' | '''Description:''' | ||

− | Random real value from 0 to x. | + | Random real value from 0 to '''x'''. |

+ | |||

'''Example:''' | '''Example:''' | ||

_rNumber = '''random''' 1 | _rNumber = '''random''' 1 | ||

+ | |||

'''Comments''' | '''Comments''' | ||

− | + | Be careful using random numbers in multiplayer, each client will come up with something different. | |

− | Be careful using random numbers in multiplayer, each client will come up with something different. See multiplayer tutorials for more general information about locality. | + | See multiplayer tutorials for more general information about locality. |

+ | |||

− | |||

The number returned is unlikely to be a whole number (e.g. 1, 4, 76, etc.). | The number returned is unlikely to be a whole number (e.g. 1, 4, 76, etc.). | ||

+ | |||

To return a whole number combine [[random]] and [[mod]]. | To return a whole number combine [[random]] and [[mod]]. |

## Revision as of 00:25, 16 April 2006

back to COMREF

**random ***x*

*x*

**Operand types:**

**x:** Number

**Type of returned value:**

**Description:**

Random real value from 0 to **x**.

**Example:**

_rNumber = **random** 1

**Comments**

Be careful using random numbers in multiplayer, each client will come up with something different. See multiplayer tutorials for more general information about locality.

The number returned is unlikely to be a whole number (e.g. 1, 4, 76, etc.).