**New course!**Every coder should learn

**Generative AI!**

0

# Explain random no generators , srand(), rand() etc?

use, example, 2 types of RNGs

1 Answer

+ 1

there are 2 types of random no. generator RNGs
1. Pseudo RNGs , that don't need any value and generate random no. s using 2 things
* cstdlib library &
*rand() function
but it's called pseudo coz it's less random in nature, can statistically determine the no.s
2. True RNGs, that need a seed value to generate best possible random no.s, hence called true
it uses 3 things
*cstdlib- the library that stores the functions
*srand(seed_value)- function to get any seed value, in my code example it's the age value.
*rand()- to generate random no.s
check out my code fun with TRNGs