+ 2
What is the basic function of random number?
answer in easy way
2 Antworten
+ 1
You use random to mimic unpredictable events. For example what's the face of the next coin flip?
You'll most likely deal with random when playing games:-
✅ What's the chance for getting a rare item in game?
✅ What's the chance to break my equipment during upgrade?
It's all about RNG (random number generator) when we deal with chance/uncertainty in-game.
+ 1
python :
from random import *
print(randint(1,7),randrange(18))
C++:
#include <csdtio>
#include <ctime>
#include <iostream>
int main(){
srand(time(0));
for(int i=1;i<11;++i)
std::cout<<rand()%(i*10)<<std::endl;
return 0;
}