+ 3
What is the real code behind random function?
when we use or call random function we get a value btw 0 and 1 (in java) ..... but what is the original code written within that function which generates it... I googled and got something named PRNG from wiki which is complex to understand.... can anyone help me to explain what is written inside random function and how does it generate a number when we call it...??
8 Réponses
+ 14
A simple sample.
https://code.sololearn.com/cMUCJqFL1X65/?ref=app
+ 6
PRNG is an algorithm that uses a seed number(example: current millisecond) to generate a seemingly random number and uses that new number as seed to generate the next one.
Check out this code and play with the values and see the result
https://code.sololearn.com/Wq8uSyoVW3Wm/?ref=app
+ 2
thnx it helped a lot 😊👌
+ 2
int i;
cout<<i;
or
char a;
cout<<a;
you will get random numbers and symbols...
+ 2
Most pseudo random number generators use the group structure of elliptic curves to generate random looking numbers. The seeds that they use often come from a so called entropy pool, which on Linux is provided by the kernel and is created from different timings of things happening on the system, like different interrupt and so on
+ 1
cool solution.... Thnx
+ 1
The random class is an algorithm and is a pseudo generator.Its part of the MATH/Generator class.
0
thks