Improve and clarify documentation for RandomNumberGenerator
This commit is contained in:
parent
6ef0b8fcd3
commit
7d4c20f9db
@ -778,7 +778,7 @@
|
||||
<return type="float">
|
||||
</return>
|
||||
<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]
|
||||
randf() # Returns e.g. 0.375671
|
||||
[/codeblock]
|
||||
@ -792,7 +792,7 @@
|
||||
<argument index="1" name="to" type="float">
|
||||
</argument>
|
||||
<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]
|
||||
prints(randf_range(-10, 10), randf_range(-10, 10)) # Prints e.g. -3.844535 7.45315
|
||||
[/codeblock]
|
||||
@ -819,7 +819,7 @@
|
||||
<argument index="1" name="to" type="int">
|
||||
</argument>
|
||||
<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]
|
||||
print(randi_range(0, 1)) # Prints 0 or 1
|
||||
print(randi_range(-10, 1000)) # Prints any number from -10 to 1000
|
||||
|
@ -23,7 +23,7 @@
|
||||
<return type="float">
|
||||
</return>
|
||||
<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>
|
||||
</method>
|
||||
<method name="randf_range">
|
||||
@ -34,7 +34,7 @@
|
||||
<argument index="1" name="to" type="float">
|
||||
</argument>
|
||||
<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>
|
||||
</method>
|
||||
<method name="randfn">
|
||||
@ -45,14 +45,14 @@
|
||||
<argument index="1" name="deviation" type="float" default="1.0">
|
||||
</argument>
|
||||
<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>
|
||||
</method>
|
||||
<method name="randi">
|
||||
<return type="int">
|
||||
</return>
|
||||
<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>
|
||||
</method>
|
||||
<method name="randi_range">
|
||||
@ -63,14 +63,14 @@
|
||||
<argument index="1" name="to" type="int">
|
||||
</argument>
|
||||
<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>
|
||||
</method>
|
||||
<method name="randomize">
|
||||
<return type="void">
|
||||
</return>
|
||||
<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>
|
||||
</method>
|
||||
</methods>
|
||||
|
Loading…
Reference in New Issue
Block a user