Random number in range

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.

math.randomseed(playdate.getSecondsSinceEpoch())
Add this to the entry point of your app

Thanks! I'll try that ASAP!

Brian

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

Thanks! That seemed to work!

Brian