summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authortree786 <yakarbala@hotmail.co.uk>2019-06-29 22:59:22 +0100
committertree786 <yakarbala@hotmail.co.uk>2019-06-30 16:41:45 +0100
commit68c6790baf84d479faef0a344cd151ea95776c0a (patch)
treee40d262130f02272c9e3801c282da8bfd011a76d /doc
parente2bbf2cba3dc97998cff0be5cbda2d7e3b7151b0 (diff)
Added example on how to use RandomNumberGenerator
Diffstat (limited to 'doc')
-rw-r--r--doc/classes/RandomNumberGenerator.xml7
1 files changed, 7 insertions, 0 deletions
diff --git a/doc/classes/RandomNumberGenerator.xml b/doc/classes/RandomNumberGenerator.xml
index 31abe9b000..9054e2fa88 100644
--- a/doc/classes/RandomNumberGenerator.xml
+++ b/doc/classes/RandomNumberGenerator.xml
@@ -6,6 +6,13 @@
<description>
RandomNumberGenerator is a class for generating pseudo-random numbers. It currently uses [url=http://www.pcg-random.org/]PCG32[/url].
[b]Note:[/b] The underlying algorithm is an implementation detail. As a result, it should not be depended upon for reproducible random streams across Godot versions.
+ To generate a random float number (within a given range) based on a time-dependant seed:
+ [codeblock]
+ var rng = RandomNumberGenerator.new()
+ func _ready():
+ rng.randomize()
+ var my_random_number = rng.randf_range(-10.0, 10.0)
+ [/codeblock]
</description>
<tutorials>
</tutorials>