Maybe I am misreading your code fragment but it seems to me that the GenerateRandomNumber function is always going to return the same value, -285764591. This may be a signed int, but it is nonetheless a 32-bit value (0xEEF79411). There is no problem passing this value around in B4X.
Not knowing the context in which this value is going to be used makes it difficult to say more.
[Edit : I probably put that the wrong way round. I should have said that the code fragment produces the value 0xEEF79411 which is an acceptable int value (-285764591) in B4J.]