Hi,

Can someone give me the differences between & and % ?

I have the following algorithm which limits a random variable to 255 only.

int nRand = rand();

nRand %= 255;

Now , doesn't the last statement have similar effect when replacing it with this.

nRand &= 255;

?