I need to generate a mask vector (unsigned char type) which contains 2 of ‘1’s only, i.e. 0x03, 0x50 and etc.
I also need these two ‘1’s distributed randomly in the vector.
How can I do this in c/c++?
Thank you!
Edit:
A more challenging and general case is asked here.
How to generate n random 1s in an unsigned char array in c/c++?
I would do like this: