Random integer isn't completely random

So I have a little set of functions to determine a random number but for some reason the number isn’t always random. Here’s an example of the code i’m using:

First function to determine a random number for 2 sets of numbers (Example: 2500 to 3000 and -2500 to -3000):

This next function uses the last one and then just assigns each random number as return values:

Finally I have a have a switch and depending on the scenario it sets the min and values:

Now the problem here is sometimes it does generate a random number but sometimes it doesn’t. For example, if put 2500 for the min value, and 3000 for the value what usually happens is the number -2500 gets chosen a lot. I’m talking like every second it gets run it chooses -2500, while other times it generates a random number such as 2738. After looking it over it looks like it should work, I don’t know what’s wrong. Any help would be appreciated, thanks!

HI

Ran a few tests, this is over 2000 randoms from 1 to 5. It appears that it favors either end.

30634-capture.jpg

30635-capture.jpg

30636-capture.jpg

My Code for testing.

hi there

just give this a try i m not a pro but in my view for coords function u dont need to create that big function and one more function within it for that functionality u can just do the following and changing the algorithm of ur coords function might fix ur problem :slight_smile:

http://s9.postimg.org/3q6n0qorz/random.png