bkumanchik
(Brian Kumanchik)
1
I'm trying to generate a random number in a range like say from 16 to 350 in Lua, I've tried:
inv_x = random.randint(16, 350)
and:
inv_x=flr(rnd(350)) + 16
Neither of these are working each one is from a different Lua program that I have used successfully but not working in the Playdate SDK.
Whitebrim
(Denisov Yaroslav)
2
math.randomseed(playdate.getSecondsSinceEpoch())
Add this to the entry point of your app
bkumanchik
(Brian Kumanchik)
3
Thanks! I'll try that ASAP!
Brian
shaun
(Shaun Inman)
4
That alone won’t do it. Neither of your original examples are native Lua or present in the SDK. You want to use Lua’s native math.random()
.
1 Like
bkumanchik
(Brian Kumanchik)
5
Thanks! That seemed to work!
Brian