Learn C++ fast - seventh tutorial(rand function and random number generator) by GhoUL

Опубликовано: 09 Август 2026
на канале: GhoUL's Tutorials
205
1

Summary:
rand() function is used to generate random numbers. But random numbers will not be truly random as it continuously gives same numbers.
To solve this problem type srand(time(0)) before using rand().

Question to solve:
Take an input between 0-9.
Use random number generator to generate numbers between 0-9 and if the number entered by user matches the random number.
Bingo!!!
This question will help you truely understand the random number generator.