An error occurring only on 4,7 inch iPhones

I made a variation of the example “Flappy”. I exported it to Xcode, and it works on any device, except the iPhone 6 and 6s (The Plus versions work perfectly)
This is the error:
Main:83: bad argument #1 to ‘random’ (number has no integer representation)
stack traceback:
[C]: in function ‘math.random’
Main:83: in function
‘spawnNext’
Main:49: in function ‘reset’
Main:14: in function ‘setup’

Does anybody know how to solve this?

You have to make the number in random an integer. You can do that by random(math.floor(number)) where number is whatever is in the random statement.