From 38fb26794bcc4352c22e46b97408673cf7084c57 Mon Sep 17 00:00:00 2001 From: Yuri Roubinsky Date: Sun, 26 Jul 2020 13:52:24 +0300 Subject: Exposed randi_range to global funcs + renamed rand_range to randf_range --- modules/gdscript/doc_classes/@GDScript.xml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'modules/gdscript/doc_classes') diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml index e170667a30..95818e5fcf 100644 --- a/modules/gdscript/doc_classes/@GDScript.xml +++ b/modules/gdscript/doc_classes/@GDScript.xml @@ -921,7 +921,7 @@ [/codeblock] - + @@ -931,7 +931,22 @@ Random range, any floating point value between [code]from[/code] and [code]to[/code]. [codeblock] - prints(rand_range(0, 1), rand_range(0, 1)) # Prints e.g. 0.135591 0.405263 + prints(randf_range(-10, 10), randf_range(-10, 10)) # Prints e.g. -3.844535 7.45315 + [/codeblock] + + + + + + + + + + + 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. + [codeblock] + print(randi_range(0, 1)) # Prints 0 or 1 + print(randi_range(-10, 1000)) # Prints any number from -10 to 1000 [/codeblock] -- cgit v1.2.3