What is the meaning of seed while generating random number | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the meaning of seed while generating random number

20th Apr 2018, 9:31 PM
Rupesh Pal
Rupesh Pal - avatar
8 Answers
+ 9
There is no true randomness in computer random functions. The sequence is always the same... to give seeming randomness we start at different places in the 'random' sequence. We usually do this by sending the current time in milliseconds as the seed! This is because different people running the same program, will then get different results. Computer randomness is often called pseudo-randomness. We mustn't assume the random generator will be the same on all platforms running C! Risky. e.g. relying on a known pseudo-randomness sequence for unit testing, can't be relied on.
20th Apr 2018, 10:10 PM
Emma
+ 4
It is too allow you to duplicate the result. Basically seed determines the order of the random numbers
20th Apr 2018, 9:52 PM
Ariela
Ariela - avatar
+ 4
Side-note Xan there's no randomness period. Even in life. Everything is cause & effect. Even on a quantum level, the slit experiments are nothing to do with the observer, but the presence (or lack of) photons. Back to our world, a dice roll is physics. In a PC, a seed is run through a complex algorithm. True randomness is if all variables are the same (recreate the exact circumstances) and achieve a different result. Just an interesting thought, didn't mean to go off-topic. @OP: What Martin, Xan, and Ariela said: you need a constantly changing number (seed) to run the RNG or you get the same result. Time's constantly changing so it makes sense to use it as a seed.
21st Apr 2018, 12:38 AM
non
+ 4
Mostly agree about randomness. Although as mortal finite beings, the world can be so complex that things definitely appear random at times. If we had a huge amount of data, air molecules, perfect representation of dice structure (every dice is different), we could in theory predict the dice throw, but then our data collection would effect the system, so practically it's difficult. You are part of the system, so you knowing about a subset of the system, changes you (who is a subset of the system!). Also quantum level is random. We can give something a statistical measure, but we can't predict it: http://www.askamathematician.com/2009/12/q-do-physicists-really-believe-in-true-randomness/
21st Apr 2018, 3:43 AM
Emma
+ 2
@Xan: I like your system/subset logic :) I read the article (had to use my PC to read it properly). I see the proofs neatly lined up, but I still can't help but think about something I've often spoken to people about: Time does not exist. Change does, but not time as measured mechanically. The main reason was I realised there was an infinitely thinner slice you could cut a moment into. I was forced to accept there is no "time" as such. Later, much later, I read some articles, saw some videos, did some poking around, and behold I stumbled upon the quantum realm. To cut a long story short, I realised that self-interference supported my "no time" theory. Actually the link you posted helps confirm it. By removing the linear notion of time and accepting that everything "we know" exists relative to us and our "time", we are free to look at much smaller masses that are less tied to "our time". There becomes no reason a projected photon cannot interfere with itself a millisecond ago. I know, I'm starting to sound very hypothetical like a certain particle that could move faster than light, but I assure you I won't go there. In a nutshell, I simply believe that _possibly_ (okay I personally believe): mass determines "relative time" and that that relative time can be a negative number. Therefore: *. Radioactive decay of an atom may be affected post-observation. *. Slit experiment may be affected post-observation. *. The final remnants of the universe itself may be responsible for the "Big Bang" (Although this doesn't mean I don't believe in God, I do and believe He/She/It has left us one helluva puzzle, but I'm just curious.) Sounds like pseudo-science, maybe it is. I come from a third-world country. I've had to educate myself on scraps between trying to graduate high school, getting a job, nearly dying, working with brain damage that took ~30 points off my IQ and messed up my memory, and surviving the crime rate. AFAIK just because you can't measure it doesn't mean it's random IMHO. I'm with Einstein on this.
21st Apr 2018, 11:21 AM
non
+ 2
nonzyro and Xan, the tangential off-topic masters ;-)
21st Apr 2018, 11:52 AM
Emma
+ 2
Xan Yeah, way to go off-topic XD
21st Apr 2018, 11:50 PM
non
+ 1
nonzyro Lovely ideas :-) Quantum physics apparently does agree that the time arrow doesn't go in one direction. I heard that time does exist, but not necessarily as we experience it! Pre big bang, there apparently was no time. But how can there be a BEFORE time!? Time is so complex, as is randomness. I setup a chat group for stuff like this. I think I might do time, and later randomness, as themes! Thanks for the inspiration. I don't know enough about either of those topics, but they are fun to talk about. Thanks for your insights. You got me thinking. I'll definitely reflect on your ideas.
21st Apr 2018, 11:51 AM
Emma