User Tools

Site Tools


uphp:functions:rand

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

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====== 
 + 
 +<badge>WMPRO, WMMINI FW >= 1.893</badge> <badge>WMMEGA FW >= 2.0</badge> 
 + 
 +<html>Return a random <b><span style="color:green">integer<span style="color:black"></b> between <b><span style="color:blue">min<span style="color:black"></b> and <b><span style="color:blue">max</b></html> 
 + 
 +====Description==== 
 + 
 +<well size="sm"><html> 
 +<span style="font-size:125%;color:green">int 
 +<span style="color:black">rand ( 
 +<span style="color:green">int 
 +<span style="color:blue">$min<span style="color:black">, 
 +<span style="color:green">int 
 +<span style="color:blue">$max 
 +<span style="color:black">
 +</html></well> 
 + 
 +<html>This function returns a pseudo-random whole number that is greater than or equal to <b><span style="color:blue">min<span style="color:black"></b> and less than <b><span style="color:blue">max</b></html> 
 + 
 +====Parameters==== 
 + 
 +<html><b><span style="color:blue">$min<span style="color:black"></b></html>:  Minimum possible value 
 + 
 +<html><b><span style="color:blue">$max<span style="color:black"></b></html>:  Maximum, returned values will be less than this 
 + 
 +====Return Values==== 
 + 
 +Pseudo-random <html><b><span style="color:green">integer<span style="color:black"></b></html> 
 + 
 +====Example==== 
 + 
 +===Generate 5 random numbers between 0 and 99=== 
 + 
 +<code php> 
 +<pre><? 
 +  for ($i=1; $i<=5; $i++) { 
 +    print(rand(0,100)."\r\n"); 
 +  } 
 +?></pre> 
 +</code> 
 + 
 +Typical output for the above example (actual results vary randomly)
 + 
 +<code> 
 +76 
 +44 
 +12 
 +49 
 +84 
 +</code>
  
-Generates a random whole number value between min and max 
uphp/functions/rand.1494676985.txt.gz · Last modified: 2021/09/13 05:56 (external edit)