How to pick a random number from an array

Basically we have this 7 bit binary code, and i would like to pick out 3 numbers randomly from it, how do we do that ?

for example 1011101

int Num[7];

	for(int i=6; i>=0 ; i--)
		{Num[i] = binary % 2;
	binary = binary/10;}
Use the random number generators like std::mt19937 or std::rand(), documentation:
You can also use std::shuffle() and pick the 1st three numbers after shuffling.
I suppose that's correct, altho it would always take more CPU time to shuffle than to generate 3 random numbers and use those as indices.
Topic archived. No new replies allowed.