Well there's a deficiency due to truncation problems, I guess you should use something like this instead:
static double rand01()
{
int r;
while((r=rand())==RAND_MAX);
return (double)rand/RAND_MAX;
}
...
if(rand01()<(double)(10-fillers_used)/(60-i)){
...
Apart from this, the process is unbiased. To prove this, we can use a little probability. Let's call Pn the probability that the process uses a filler value at position n. Also, let p=10/60, q=1-(10/60).Then: _P_0 = 10/60 _P_1 = _P_0·(9/59)+(1-_P_0)·(10/59) = (10/60)·(9/59)+(50/60)·(10/59) = 590/3540 = 10/60 P__n = p__n·((10-n)/(60-n)) + p__n-1·q·((10-(n-1))/(60-n)) + ··· + q__n·(10/(60-n)) It can be formally proven that P__n = 10/60 for every n, but also a small test program doing the calculations will convince you. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo