mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-25 01:24:23 +00:00
Have Random.sample
return null when the given array is empty
This commit is contained in:
parent
081a4f905d
commit
26ec8320d2
1 changed files with 2 additions and 0 deletions
|
@ -13,6 +13,8 @@ static var rng: RandomNumberGenerator = null:
|
|||
|
||||
|
||||
static func sample(array: Array[Variant], imin = null, imax = null) -> Variant:
|
||||
if len(array) == 0:
|
||||
return null
|
||||
if imin == null:
|
||||
imin = 0
|
||||
if imax == null:
|
||||
|
|
Loading…
Reference in a new issue