Add choice method in rand ()

As in python random module. It can be useful for levels instead "someArray[@world.rand.rand(someArray.length)]".
This commit is contained in:
Bryukhanov Valentin 2016-05-26 19:44:50 +03:00 committed by Nick Winter
parent de9761073d
commit 7e958639b2

View file

@ -48,6 +48,9 @@ class Rand
arr[j] = arr[i]
arr[i] = t
arr
choice: (arr) =>
return arr[@rand arr.length]
module.exports = Rand