Home > Back-end >  Strives for the big help
Strives for the big help

Time:09-21

G.E [I] [j]=rand () % 2;
Why am I the random value is always 0,

CodePudding user response:

Add a srand random number seed give it a try

CodePudding user response:

Your srand () function in where, if put into circulation,

In addition, the rand () % 2 get random number range is 0, 1

CodePudding user response:

Srand ((unsigned) time (NULL));
G.E [I] [j]=rand () % 2;
I also always is 0

CodePudding user response:

Srand me in what position is useless, circulation use both inside and outside
  • Related