Jump to content

How do computers pick Random Numbers?


ed84c

Recommended Posts

they use an algorithm that implies shift registers with feedbacks, it`s a psuedo random number generator but it`s still a rolling code, often it will allow a "SEED" value to be introduced as a starting point, but it will still loop again (unless you`re clever and use the internal clock register as the seed value) :))))

Link to comment
Share on other sites

a program is blown into a ROM, or maybe even writen to your s/ware (OS).

 

that program uses virtual shift registers that send a sequence of binary 1`s and 0`s down a line, that sequence is fed by another shift register but maybe at a different output point and so on,,, some of the outputs from an affected register is uded to feed 1s or 0`s into another as a feedback, the whole think casscades into seemingly chaos (in fact it will reproduce the same sequence again after a period of time, an 8 stage by 15 with a parrity from the carry and fed back will give a sequence of about 17 thousand iirc).

 

we use them as psuedo random white and pink noise generators in digi-synths.

 

as this is Virtual and entirely a construct within a table, the initial value used is always pre-set. so the sequence may SEEM random and infact will be for all intents and purposes, the same seq will kick the same numbers each time it`s reset and begun again.

 

the initial value is often a mem location that the rom or s/ware sends a default value to, this need NOT be the case however :)

you can put your own "Start" value in there :)

and what better than to use the clock registers val, it changes every second, and on a fast enough encoded prog (MC) it`s as near as damnit random :)

 

there are other seed entry paths that are even better, but I`ll not go into them just yet :)

 

 

forgive the typos, it was done on the fly :)

Link to comment
Share on other sites

So basically if thats not clear just imagine a number like pi that starts with 3.14 and goes on and on without a detectable pattern: 3.14.................. The computer uses equations to produce numbers like pi that go on and on without a pattern and then chooses one of the numbers. It needs a start number to plug into the equation, which it gets from the internal clock of the computer. Did I get that right YT? Was that close at all?

Link to comment
Share on other sites

Perhaps in the future we'll have computers that use radioactive nucleus-based random number generators. :)

 

"forgive the typos, it was done on the fly :)"

 

YOU AWFUL MAN! I'm going to call the activists - here's a Britt that sits on a fly while writing posts to forums! Awful, very awful.

 

<That was for the member 15 thing you did with ed, you evil, evil man :) >

Link to comment
Share on other sites

So basically if thats not clear just imagine a number like pi that starts with 3.14 and goes on and on without a detectable pattern: 3.14.................. The computer uses equations to produce numbers like pi that go on and on without a pattern and then chooses one of the numbers. It needs a start number to plug into the equation, which it gets from the internal clock of the computer. Did I get that right YT? Was that close at all?

sort of, a computer using a shift register set will genetate psuedo random numbers, unlike Pi that is entirely random as far as we know, also Pi never repeats itself whereas a ran mun gen will eventualy and start the whle seq again and again forever....

 

the seed value or offset is pre loaded but can often be altered to anything you like, I could enter 2095 as the "seed" but it would still cycle the same num seq just witha dif offset,

 

and so to amke things a little MORE "random" seed it with the realtime clock value, that way each second presnents a dif value, and so it`ll be the number of numbers in a cylcle to to the power of the number of seconds in a day, thus the likelyhood of it ever repeating is practicaly zilch :)

 

still not TRUE random, but a repeat sequence... naaah :)

esp if you incorporate the date too :)

Link to comment
Share on other sites

they use an algorithm that implies shift registers with feedbacks, it`s a psuedo random number generator but it`s still a rolling code, often it will allow a "SEED" value to be introduced as a starting point, but it will still loop again (unless you`re clever and use the internal clock register as the seed value) :))))

 

try and understand this explanation. it is 101% correct. which bit dont you understand?

 

just to make clear that different programs use different methods to produce random numbers (as suggested in YT's explanation) so unless you try and decrypt (e.g. excel) you wont know which exact algorithm they use so dont ask!

 

incidently go onto MS Word (i think any edition) and type:

=rand(200,00)

exactly like that and then press enter... you'll know if it has worked.

similarly excel 97 has an inbuilg game in it (i will post how to access it if anyone still has MS excel 97)

Link to comment
Share on other sites

its not random. it is a number the computer gets based slightly on what its clock says when you ask it. the algorithm is complex enough that you wont be able to find the pattern, but the pattern is still there. as for all the gory details in between, i have no idea what it does to get the number, i just know that it isnt actually random.

Link to comment
Share on other sites

its not random. it is a number the computer gets based slightly on what its clock says when you ask it. the algorithm is complex enough that you wont be able to find the pattern, but the pattern is still there. as for all the gory details in between, i have no idea what it does to get the number, i just know that it isnt actually random.

 

That just about sums it up.

 

The gory details are just algorithms.

http://www.gnu.org/software/gsl/manual/gsl-ref_17.html#SEC271

Scroll down a little and you should see some of the formulas they use.

 

Also try googling random number generator source code. ;)

Link to comment
Share on other sites

Pseudo random number generation is one way to do it.

There are alternate methods to get random numbers direct out of harware or "true random numbers".

 

I know this since java has 2 different random number geerators, one of which uses pseudo random number generation, asking for seeds etc whereas the other supposedly ives the true random numbers.

 

Any ideas how they do it in hardware ?

Link to comment
Share on other sites

with hardware, they use real shift registers in a cascade, the output then sent to a chip register and held until read, the control line is active while the chip reg is being read, and that advances to the next code and the control line goes low again.

 

"I can tell you what I don't understand:

 

1) virtual shift register --Is that like a switch?

2) "we use them as psuedo random white and pink noise generators in digi-synths." --I dont understand a word of that

3) rolling code--Is that like a loop?"

 

1) a sfift register is actualy hardware, but its action can be simulated in a program.

2) white noise generators can be digital or analogue, the digital ones use the shift reg cascade and the output is sent to a D to A converter and then amplified to make white noise, the cascade clock can be adjusted on a digital gen to make pink noise (low fequency white noise) by slowing the clock down. on an analogue version, there`s only white noise and a series of filters are applied to make pink noise (pink noise sounds a bit like thunder).

 

3. yeah, it`s a number sequence that loops, the sequence can be millions of numbers long, but will always start back at the beginning eventualy.

 

hope that helps a little :)

Link to comment
Share on other sites

over complicated it? how?

 

I`ll be happy to try and explain a little easier if I can, but I thought I`de done that :(

 

edit, looking back maybe this may help: Dto A = Digital to Analogue converter, basicly, it`s jod is to take a binary value and convert it into a voltage or current, like an R2R ladder network. each 1 presents roughly a 5v signal and each 0 a nothing volt signal, using these values they can be converted either using tables with a VRef offset OR the R2R ladder, then a simple PD is taken from the overall pressented value and then amplified :)

 

the Synth is a musical instrument (electronic), white noise id used for Hi-Hat or cymbals or wind sound effects with Q filter feedback.

Pink noise is for things like a Bass Drum :)

 

 

hope that clears up some stuff?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.