diff options
author | Max Hilbrunner <mhilbrunner@users.noreply.github.com> | 2022-10-21 16:25:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-21 16:25:52 +0200 |
commit | 5cefc07d908be50ac88ede8bce5572b030815695 (patch) | |
tree | 7141c95b9024f92d354c198dc54ce5c2e6000c88 /doc/classes | |
parent | c4c35ab77a4090b0b8f813bce71fdf3053f65a05 (diff) | |
parent | 9f4dbf415da6d150788915cb35a9c3dc7f04c547 (diff) |
Merge pull request #67444 from nonunknown/array_pick_random
Add ability to pick random value from array
Diffstat (limited to 'doc/classes')
-rw-r--r-- | doc/classes/Array.xml | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index a30117725f..0f76639caf 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -435,6 +435,16 @@ Returns the minimum value contained in the array if all elements are of comparable types. If the elements can't be compared, [code]null[/code] is returned. </description> </method> + <method name="pick_random" qualifiers="const"> + <return type="Variant" /> + <description> + Returns a random value from the target array. + [codeblock] + var array: Array[int] = [1, 2, 3, 4] + print(array.pick_random()) # Prints either of the four numbers. + [/codeblock] + </description> + </method> <method name="pop_at"> <return type="Variant" /> <param index="0" name="position" type="int" /> |