0

Logic of Randomising

I was searching for a simple code of throwing any random number. But as computer cannot compute without logic. So what is the way of throwing any random number in data

10th Jun 2018, 2:00 PM
Kanan Yagnik
Kanan Yagnik - avatar
2 Respuestas
+ 5
"Randomness" can come from a lot of sources. Thermal noise, humidity, currents, etc. The most widely used source would be time. In C/C++, for instance, time(0) returns epoch time (number of seconds since 1st of January, 1970). Combine this with some equation, you get a pretty nice "random" number generator. https://code.sololearn.com/cMUCJqFL1X65/?ref=app
10th Jun 2018, 2:23 PM
Hatsy Rei
Hatsy Rei - avatar
+ 2
Randomness is generated by physical conditions such as ones Hatsy Rei listed like thermal noise, humidity, time, microphone input, etc. In Linux, this data is stored in /dev/random and /dev/urandom
11th Jun 2018, 3:54 PM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar