Difference between revisions of "Random"

From King Arthur's Gold Wiki
Jump to: navigation, search
 
Line 2: Line 2:
 
Returns a pseudo-random int in the range 0 to the given max int.
 
Returns a pseudo-random int in the range 0 to the given max int.
 
</onlyinclude>
 
</onlyinclude>
 +
 +
This method is part of the Maths namespace so you need to prefix calls to it with 'Maths::'.
  
 
This method has two variants. One of them also accepts a seed.
 
This method has two variants. One of them also accepts a seed.
 
<syntaxhighlight lang="cpp">
 
<syntaxhighlight lang="cpp">
int Random(int max)
+
int Maths::Random(int max)
int Random(u32 seed, u32 max)
+
int Maths::Random(u32 seed, u32 max)
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
[[Category:Scripting]]
 
[[Category:Scripting]]
 
[[Category:Global Functions]]
 
[[Category:Global Functions]]

Latest revision as of 23:25, 6 September 2012

Returns a pseudo-random int in the range 0 to the given max int.


This method is part of the Maths namespace so you need to prefix calls to it with 'Maths::'.

This method has two variants. One of them also accepts a seed.

int Maths::Random(int max)
int Maths::Random(u32 seed, u32 max)