Is rand function random at all? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is rand function random at all?

For example, If i make a game with a rand function in it. Does it make same output evertime the game resets or it will change?

20th May 2019, 10:10 AM
PG Dominator
PG Dominator - avatar
4 Answers
23rd May 2019, 12:29 PM
Abhinav
+ 3
PG Dominator don't try to understand the logic just see that it is generating random number without repeating.
23rd May 2019, 12:35 PM
Abhinav
+ 2
Because you have not provided a time variable try using Rand() and stand() functions.
20th May 2019, 10:36 AM
Abhinav
+ 1
I know that it will not change in a c++ program my question is for games and game engines
20th May 2019, 10:11 AM
PG Dominator
PG Dominator - avatar