Performance adjustment – speed up a code

Writing the following code:

n = 10 ^ 6;
min = 1;
max = 2;
storage = {};
Do[flag1 = 0;
flag2 = 0;
flag3 = 0;
tot = 0;
Do[i1 = 0;
i2 = 0;
i3 = 0;
While[i1<i&&i2[i1<i&&i2[i1= i && i2> = i,
flag3 = flag3 + 1,
Yes[i1> i2,
flag1 = flag1 + 1,
flag2 = flag2 + 1
]];
tot = tot + i3,
{j, 1, n}];
storage = join[storage, {{100. flag1, 100. flag2, 
                              100. flag3, 1. tot}/n}],
{i, min, max}]

I get exactly what I want, but unfortunately the execution speed is too slow.

Could someone kindly tell me how to modify it to make it faster?