+ 1
Give me a code in C++ showing the algorithm to generate pseudo random numbers.
Algorithm to Pseudo Random Numbers in C++.
3 Answers
+ 2
Heres a simple way
-int i=rand()%10;
It will generate some random value btn 0-10;
C++ provides a better alternative to this tho.. Its available in the header <random>,
Refer to "C++ standard library refrence" to learn more..
+ 2
Well Simon
I know that by using rand or random function...we can do that
Actually my question was not clear...
I actually asked about the algorithm...
Can anyone throw any light on the algorithm of pseudo random number generator
+ 1
int Seed;
int GetRandom(int Max){
return ( Seed *= 5435362342352535 ) % Max;
}
jprd aĆŒ siÄ nie chce na takie pytanie odpisywaÄ po ang. poniewaĆŒ szybciej mi bÄdzie w pl. nie ma algorytmu na randomy, pobierane jest ono z czasu komputera wiÄc jak chcesz kurw* zrobiÄ algorytm?
pobierasz CZAS aby dostaÄ radomowego numera...