+ 2
How is random worked out?
I'm curious as to how computers pick random numbers or things from a list, do they go online? Is it completely random or is there a pattern? If there is a pattern could I work out the next number my code will "randomly" generate? I've been told it's something to do with the time but that doesn't make much sense to me... If anyone can explain, thanks in advance
2 Answers
+ 5
Something being truly random is difficult when you're trying to create it in a way that isn't random. Most things that are called random are actually pseudo-random; just trickery to appear random. We base it upon the time because every second isn't any other second in time. Get what I mean? If you counted from 1 to infinity, each time I asked you what number you're on it would be a different number. As such, if you base your means of creating a random number upon time, it'll always be a new random number that is different from the random number previously presented. It's a good means of accomplishing this task.
+ 6
Generating random number is fixed algorithm that outputs unpredictable sequence of numbers based on input. But when you pass the same input (seed) you will get the same sequences. For really randomly numbers often uses non-repeatable input, and tick count greatly comes to for seed