- What do you want to achieve?
I want to know why I am unable to use numbers over 32 bits without it breaking.
- What is the issue?
I have been using very large numbers recently(in hexadecimal) for a private project. I have used it in a math.random function which looked something like this:
When I try that, my output was:
print(math.random(0xFF,0xFFFFFFFFFFFFFFFFFFFFF) ):1: invalid argument #2 to 'random' (interval is empty)
I looked up the error on the devforum, and all I found was that you get the error when the second number is 0 or something. So I tried to swap the numbers around and I got the number -2147483648. And I had ran it again and it hadn’t changed, no matter how many times it would be the same number. So that kind of solved why math.random was erroring but it still didn’t explain why it was a negative number. I got rid of some of the digits and I found that it breaks at 32 bits. I haven’t found any post documenting this. I would’ve reported this on bug reports if I was able to but unfortunately I can’t as I am not a regular and I am pretty sure I can’t become a regular at the moment. I would like it if someone could help explain why this is not working.