Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis0
When we use rand() in random, why do we always get 41 as the filing output while it should vary with every outcome?
7 Respostas
+ 7
use srand() or srand(time(0))
+ 6
Change the seed value to get other values.
+ 4
Since most(almost all except some scientific) computers can't generate random number what they do is generating pseudo-random number. To do this what they do is take a seed value(initial value) and do some calculations on it so as to change.
you can change seed value using srand() function in c/c++.
+ 3
In what language are you writing? Idk what would to be. But any value that you pass to the seed will change the random number you get
0
What's seed value