mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-27 06:23:41 -04:00
Add choice
method in rand
(#3682)
As in python random module. It can be useful for levels instead "someArray[@world.rand.rand(someArray.length)]".
This commit is contained in:
parent
de9761073d
commit
7e958639b2
1 changed files with 3 additions and 0 deletions
|
@ -48,6 +48,9 @@ class Rand
|
|||
arr[j] = arr[i]
|
||||
arr[i] = t
|
||||
arr
|
||||
|
||||
choice: (arr) =>
|
||||
return arr[@rand arr.length]
|
||||
|
||||
|
||||
module.exports = Rand
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue