I think I have it fixed.
Use the Round function to round your inputs before getting a random value and it seems to work.