summaryrefslogtreecommitdiffstats
path: root/doc/classes/RandomNumberGenerator.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/RandomNumberGenerator.xml')
-rw-r--r--doc/classes/RandomNumberGenerator.xml6
1 files changed, 3 insertions, 3 deletions
diff --git a/doc/classes/RandomNumberGenerator.xml b/doc/classes/RandomNumberGenerator.xml
index e005c1c22c..44e29d2322 100644
--- a/doc/classes/RandomNumberGenerator.xml
+++ b/doc/classes/RandomNumberGenerator.xml
@@ -24,13 +24,13 @@
Returns a random index with non-uniform weights. Prints an error and returns [code]-1[/code] if the array is empty.
[codeblocks]
[gdscript]
- var rnd = RandomNumberGenerator.new()
+ var rng = RandomNumberGenerator.new()
- var my_array = ["one", "two", "three, "four"]
+ var my_array = ["one", "two", "three", "four"]
var weights = PackedFloat32Array([0.5, 1, 1, 2])
# Prints one of the four elements in `my_array`.
- # It is more likely to print "four", and less likely to print "two".
+ # It is more likely to print "four", and less likely to print "one".
print(my_array[rng.rand_weighted(weights)])
[/gdscript]
[/codeblocks]