vendredi 10 juillet 2015

2-D array of zeroes and ones

I want to generate a 2-D array of zeroes and ones so that it is 25% zeroes and 75% ones.

I know that I will be using the rand()%2 function but how do i limit the zeroes to be only 25 percent of the array?




Aucun commentaire:

Enregistrer un commentaire