summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2021-07-02 17:47:17 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2021-07-02 17:47:52 +0200
commit7d4c20f9db656440c2ff6bbdba8d863a20827ab7 (patch)
treeae201cdb74b1efd2bd377d025e4b0325022e56e2 /doc
parent6ef0b8fcd3ba2bcedbfae4a9575b9ca7488da34b (diff)
Improve and clarify documentation for RandomNumberGenerator
Diffstat (limited to 'doc')
-rw-r--r--doc/classes/@GlobalScope.xml6
-rw-r--r--doc/classes/RandomNumberGenerator.xml12
2 files changed, 9 insertions, 9 deletions
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index daabc2c83b..66511f5845 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -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
diff --git a/doc/classes/RandomNumberGenerator.xml b/doc/classes/RandomNumberGenerator.xml
index 6fcb79b5fe..9c84cdd03e 100644
--- a/doc/classes/RandomNumberGenerator.xml
+++ b/doc/classes/RandomNumberGenerator.xml
@@ -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>