![]() |
|
| *AX SOFT>>>Programming & Design |
How can a computer be random? |
I'm a pretty logical/mathematical thinker, and I've always wondered how computer programs can generate random numbers. Obviously, a processor doesn't have a will, so it can't just "pick" a number, and yet so many functions in computer programs require the computer to make a random choice. How is that possible? (Try to keep it in Laymen's terms, I'm not a programmer) hehe, good question. The answer is it can't. In the absence of this, 'pseudorandom' is good enough. If it appears random to us, what's the difference? A common technique used is, when a function requests a random number it uses an equation where the current CPU tick is the independent variable. Every time an instruction executes, the tick is incremented by 1. Another technique is to use the current system time, as it will always be different when a random number is requested. The quick answer is that it cannot be. If you have a program that generates random variables, it will tend to generate the same numbers each time it is run. Long ago though, programmers found ways around this, such as tieing the random number generation into the clock, so that the number that is seeded into the random number generator is based on the number of seconds in the day so far or something similar. This allows for the appearance of randomness. The more complex a program is, the more random it is going to appear as well. The real answer is: it can't. Computer software can only produce a pseudo random number. My guess is that it is probably time based. If a computer processor can produce a key let's say 100 times a second. Then it would probably just keep producing those keys untill a specific time is given. For instance, if it was told to randomly pick a number out of a list of 1000 numbers, it would probably keep cycling through that list a gazillion times until it hit a certain time.....maybe 5 seconds? Then after 5 seconds wherever it is on that list when the time is up is the "random key" Actually, most computers can generate random numbers by sampling thermal noise in a simple circuit. This is a quantum mechanical phenomenon, and is truly random. Unfortunately, it doesn't produce random numbers very quickly. |
| Tags |
| General - Computers & Internet Software Security Programming & Design Facebook Flickr Google MSN MySpace |
| Related information |
In firefox you go to tools options content. Then click the check box next to enable java script. In internet explorer you go to tools internet options then click the security tab, set your own cust... Very nice. You will be a successful web designer when you finish school. As the other said, the content has bad spelling and grammar which should be reviewed. ...... Faren = JOptionPane.showInputDialog("X: ) f = Double.parseDouble(Faren); That's 2 line's of code, and you didn't close your String. Change to... Faren = JOptionPane.show... i've been doing banners at skool for my it coursework and i had to use dreamweaver to do it ...have you run your security you could take windows back and you will loose nothing from your pc , e-mail me if you want to ...Men, take it easy. If you want to learn something in life, you've got to start by the smallest things, and them move on to the bigger ones. Web-design is a whole-thing, big action range. Th... It looks as though it literally collapses borders together, i.e., it merges the table border with the cell border. You can "separate" them or "collapse" them. ... |
Categories--Copyright/IP Policy--Contact Webmaster |