1
Fork 0
mirror of https://github.com/Steffo99/hella-farm.git synced 2024-11-21 15:44:23 +00:00

Have Random.sample return null when the given array is empty

This commit is contained in:
Steffo 2024-04-19 01:54:25 +02:00
parent 081a4f905d
commit 26ec8320d2
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0

View file

@ -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: