Explain random no generators , srand(), rand() etc? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

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

use, example, 2 types of RNGs

9th Dec 2016, 10:47 AM
Morpheus
Morpheus - avatar
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
9th Dec 2016, 10:47 AM
Morpheus
Morpheus - avatar