O Ilusionista
Captain 100K
Now I have doubt about it.
http://www.cplusplus.com/reference/cstdlib/rand/
But in OpenBOR:
rand()%100 starts from -100 to 100, or am I crazy?
I often see people using random()%100+100 to get a positive value and not start with a negative one.
What is the right to do?
http://www.cplusplus.com/reference/cstdlib/rand/
v1 = rand() % 100; // v1 in the range 0 to 99
v2 = rand() % 100 + 1; // v2 in the range 1 to 100
v3 = rand() % 30 + 1985; // v3 in the range 1985-2014
Notice though that this modulo operation does not generate uniformly distributed random numbers in the span (since in most cases this operation makes lower numbers slightly more likely).
But in OpenBOR:
rand()%100 starts from -100 to 100, or am I crazy?
I often see people using random()%100+100 to get a positive value and not start with a negative one.
What is the right to do?