Improve and clarify documentation for RandomNumberGenerator
This commit is contained in:
@ -778,7 +778,7 @@
|
|||||||
<return type="float">
|
<return type="float">
|
||||||
</return>
|
</return>
|
||||||
<description>
|
<description>
|
||||||
Returns a random floating point value on the interval [code][0, 1][/code].
|
Returns a random floating point value between [code]0.0[/code] and [code]1.0[/code] (inclusive).
|
||||||
[codeblock]
|
[codeblock]
|
||||||
randf() # Returns e.g. 0.375671
|
randf() # Returns e.g. 0.375671
|
||||||
[/codeblock]
|
[/codeblock]
|
||||||
@ -792,7 +792,7 @@
|
|||||||
<argument index="1" name="to" type="float">
|
<argument index="1" name="to" type="float">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Random range, any floating point value between [code]from[/code] and [code]to[/code].
|
Returns a random floating point value on the interval between [code]from[/code] and [code]to[/code] (inclusive).
|
||||||
[codeblock]
|
[codeblock]
|
||||||
prints(randf_range(-10, 10), randf_range(-10, 10)) # Prints e.g. -3.844535 7.45315
|
prints(randf_range(-10, 10), randf_range(-10, 10)) # Prints e.g. -3.844535 7.45315
|
||||||
[/codeblock]
|
[/codeblock]
|
||||||
@ -819,7 +819,7 @@
|
|||||||
<argument index="1" name="to" type="int">
|
<argument index="1" name="to" type="int">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Random range, any 32-bit integer value between [code]from[/code] and [code]to[/code] (inclusive). If [code]to[/code] is lesser than [code]from[/code] they are swapped.
|
Returns a random signed 32-bit integer between [code]from[/code] and [code]to[/code] (inclusive). If [code]to[/code] is lesser than [code]from[/code], they are swapped.
|
||||||
[codeblock]
|
[codeblock]
|
||||||
print(randi_range(0, 1)) # Prints 0 or 1
|
print(randi_range(0, 1)) # Prints 0 or 1
|
||||||
print(randi_range(-10, 1000)) # Prints any number from -10 to 1000
|
print(randi_range(-10, 1000)) # Prints any number from -10 to 1000
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
<return type="float">
|
<return type="float">
|
||||||
</return>
|
</return>
|
||||||
<description>
|
<description>
|
||||||
Generates a pseudo-random float between [code]0.0[/code] and [code]1.0[/code] (inclusive).
|
Returns a pseudo-random float between [code]0.0[/code] and [code]1.0[/code] (inclusive).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="randf_range">
|
<method name="randf_range">
|
||||||
@ -34,7 +34,7 @@
|
|||||||
<argument index="1" name="to" type="float">
|
<argument index="1" name="to" type="float">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Generates a pseudo-random float between [code]from[/code] and [code]to[/code] (inclusive).
|
Returns a pseudo-random float between [code]from[/code] and [code]to[/code] (inclusive).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="randfn">
|
<method name="randfn">
|
||||||
@ -45,14 +45,14 @@
|
|||||||
<argument index="1" name="deviation" type="float" default="1.0">
|
<argument index="1" name="deviation" type="float" default="1.0">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Generates a [url=https://en.wikipedia.org/wiki/Normal_distribution]normally-distributed[/url] pseudo-random number, using Box-Muller transform with the specified [code]mean[/code] and a standard [code]deviation[/code]. This is also called Gaussian distribution.
|
Returns a [url=https://en.wikipedia.org/wiki/Normal_distribution]normally-distributed[/url] pseudo-random number, using Box-Muller transform with the specified [code]mean[/code] and a standard [code]deviation[/code]. This is also called Gaussian distribution.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="randi">
|
<method name="randi">
|
||||||
<return type="int">
|
<return type="int">
|
||||||
</return>
|
</return>
|
||||||
<description>
|
<description>
|
||||||
Generates a pseudo-random 32-bit unsigned integer between [code]0[/code] and [code]4294967295[/code] (inclusive).
|
Returns a pseudo-random 32-bit unsigned integer between [code]0[/code] and [code]4294967295[/code] (inclusive).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="randi_range">
|
<method name="randi_range">
|
||||||
@ -63,14 +63,14 @@
|
|||||||
<argument index="1" name="to" type="int">
|
<argument index="1" name="to" type="int">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Generates a pseudo-random 32-bit signed integer between [code]from[/code] and [code]to[/code] (inclusive).
|
Returns a pseudo-random 32-bit signed integer between [code]from[/code] and [code]to[/code] (inclusive).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="randomize">
|
<method name="randomize">
|
||||||
<return type="void">
|
<return type="void">
|
||||||
</return>
|
</return>
|
||||||
<description>
|
<description>
|
||||||
Setups a time-based seed to generator.
|
Setups a time-based seed to for this [RandomNumberGenerator] instance. Unlike the [@GlobalScope] random number generation functions, different [RandomNumberGenerator] instances can use different seeds.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
</methods>
|
</methods>
|
||||||
|
|||||||
Reference in New Issue
Block a user