Generating a uniform distribution of INTEGERS in C
Let’s assume that rand() generates a uniformly-distributed value I in the range [0..RAND_MAX], and you want to generate a uniformly-distributed value O in the range [L,H]. Suppose I in is the range [0..32767] and O is in the range [0..2]. According to your suggested method, O= I%3. Note that in the given range, there are … Read more