This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
uphp:functions:rand [2017/05/13 12:03] admin created |
uphp:functions:rand [2021/09/13 05:57] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | int rand(int min, int max) | + | ======rand====== |
+ | |||
+ | < | ||
+ | |||
+ | < | ||
+ | |||
+ | ====Description==== | ||
+ | |||
+ | <well size=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | |||
+ | ====Parameters==== | ||
+ | |||
+ | < | ||
+ | |||
+ | < | ||
+ | |||
+ | ====Return Values==== | ||
+ | |||
+ | Pseudo-random < | ||
+ | |||
+ | ====Example==== | ||
+ | |||
+ | ===Generate 5 random numbers between 0 and 99=== | ||
+ | |||
+ | <code php> | ||
+ | < | ||
+ | for ($i=1; $i<=5; $i++) { | ||
+ | print(rand(0, | ||
+ | } | ||
+ | ?></ | ||
+ | </ | ||
+ | |||
+ | Typical output for the above example (actual results vary randomly): | ||
+ | |||
+ | < | ||
+ | 76 | ||
+ | 44 | ||
+ | 12 | ||
+ | 49 | ||
+ | 84 | ||
+ | </ | ||
- | Generates a random whole number value between min and max |