random number generator
Forum » Miscellaneous / Open Topic » random number generator
Started by: bxsciencerbxsciencer
On: 1246040596|%e %b %Y, %H:%M %Z|agohover
Number of posts: 15
rss icon RSS: New posts
random number generator
bxsciencerbxsciencer 1246040596|%e %b %Y, %H:%M %Z|agohover

is there any conceivable way to create a rng that generates different numbers for the same seed

or can someone give me the actual formula for a random number generator (not just randInt())


Visit Calccrypto for info on crypto

unfold random number generator by bxsciencerbxsciencer, 1246040596|%e %b %Y, %H:%M %Z|agohover
Re: random number generator
graphmasturgraphmastur 1246042653|%e %b %Y, %H:%M %Z|agohover

List of random number generators.
or
lmgtfy which is the second one down, on the search page.


"But sanctify the Lord God in your hearts, and always be ready to give a defense to everyone who asks you a reason for the hope that is in you, with meekness and fear;" ~ 1 Peter 3:16

last edited on 1246042718|%e %b %Y, %H:%M %Z|agohover by graphmastur + show more
unfold Re: random number generator by graphmasturgraphmastur, 1246042653|%e %b %Y, %H:%M %Z|agohover
Re: random number generator
bxsciencerbxsciencer 1246044662|%e %b %Y, %H:%M %Z|agohover

thanks, but wiki doesnt tell you much. they only say that they exist

im trying to increase the randomness of my hash2x program but i cant think of any way to use any of the variables without compromising the entire algorithm


Visit Calccrypto for info on crypto

last edited on 1246044775|%e %b %Y, %H:%M %Z|agohover by bxsciencer + show more
unfold Re: random number generator by bxsciencerbxsciencer, 1246044662|%e %b %Y, %H:%M %Z|agohover
Re: random number generator
builderboybuilderboy 1246042715|%e %b %Y, %H:%M %Z|agohover

The whole point of a seed is so that you can generate the same random numbers. As for the formula, I have no idea, but it probably has something to do with bit shifting and such, most likely very complex.

unfold Re: random number generator by builderboybuilderboy, 1246042715|%e %b %Y, %H:%M %Z|agohover
Re: random number generator
WeregooseWeregoose 1246048334|%e %b %Y, %H:%M %Z|agohover

What you are asking for is a function that will generate arbitrary results for a fixed input.

So, if there exists a function that produces a sequence with one input…

ƒ(x) = an

…yet goes on to produce another sequence from the same input…

ƒ(x) = bn

…but you require that the two sequences be different

anbn

…then you can make the substitutions as follows…

anbn

ƒ(x) ≠ bn

ƒ(x) ≠ ƒ(x)

…showing that the function itself can't be in agreement with itself at any given instant.

What you are asking for is an arbitrary function. Or, something that will compute <insert sequence> given <insert function>. Unless you can get it any more well-defined than that, you're going to have a hard time programming it in.

Simpler answer: You pick one seed, you write it into your expression on paper, and then you solve it by hand. If you carry out the same procedure every time, then you should get the same answer repeatedly. Only when you try a new approach, whether it's changing the function or that pesky input, would the end result turn up as something else. This modification from the earlier test… it's called a "variable." If one number were chosen to replace it, and then all answers followed suit, then the initial input might be dubbed a "seed."

Alternate ending: You discover that by looking at your function weirdly enough, you are able to inexplicably force it to take on a new behavior from all of its previous trials. Alas, the logic is inescapable; the manner in which you looked at your function is also a variable – a veritable seed in the budding, and a "seed" in the dubbing.

Nutshell answer: Any expression with a constant form isn't going to trade results with the void. An effect requires a cause, and in the case of a RNG, that "push" is going to be the seed – that's what it's there for.

unfold Re: random number generator by WeregooseWeregoose, 1246048334|%e %b %Y, %H:%M %Z|agohover
Re: random number generator
bxsciencerbxsciencer 1246049197|%e %b %Y, %H:%M %Z|agohover

so any idea about how to generate random numbers with an actual equation?

i know there are equations like
144550627858cb6d44ceb02ba9434317.png

but what are good numbers for the constants for equations like this?

also, my main problem is that only one random number is needed everytime the progam is run


Visit Calccrypto for info on crypto

unfold Re: random number generator by bxsciencerbxsciencer, 1246049197|%e %b %Y, %H:%M %Z|agohover
Re: random number generator
WeregooseWeregoose 1246052353|%e %b %Y, %H:%M %Z|agohover

LCGs in common use

On a TI-84+, you can use the clock like so: startTmr→rand

Otherwise, a dirty trick on the 83+ is to seed rand or a function of your choosing with the user's reaction time:

getKey
0
ClrHome
Output(2,3,"Title Screen
Output(7,2,"Press any key!
Repeat getKey
Ans+1
End
Ans→rand
ClrHome
rand

The first line is the dummy getKey covered here (just above Error Conditions).

last edited on 1246066423|%e %b %Y, %H:%M %Z|agohover by Weregoose + show more
unfold Re: random number generator by WeregooseWeregoose, 1246052353|%e %b %Y, %H:%M %Z|agohover
Re: random number generator
bxsciencerbxsciencer 1246055888|%e %b %Y, %H:%M %Z|agohover

thanks, but i had hoped to be able to change it to computer code too, so maybe one day hash2x might be written in different languages and still produce the same checksums. since "rand" doesnt always use the same algorithm in every language, i was hoping to have a constant formula that only relies on constant stuff, not the speed of a user/the choice of how the function of a language works

wiki:

LCGs should not be used for applications where high-quality randomness is critical.


Visit Calccrypto for info on crypto

last edited on 1246061081|%e %b %Y, %H:%M %Z|agohover by bxsciencer + show more
unfold Re: random number generator by bxsciencerbxsciencer, 1246055888|%e %b %Y, %H:%M %Z|agohover
Re: random number generator
thornahawkthornahawk 1246074683|%e %b %Y, %H:%M %Z|agohover

"create a rng that generates different numbers for the same seed"

To reiterate… an RNG with the characteristics you say are not practical; the point of having a seed is to be able to generate the same sequence associated with that particular seed across different platforms.

"LCGs should not be used for applications where high-quality randomness is critical."

In any event, that LCG's are not "random enough" (more precisely, their periods are too short, among other weaknesses) are the reason why you have things like the "Mersenne twister" or "Blum-Blum-Shub"; go search for these topics on Google Scholar.

There's also a discussion of RNGs in Numerical Recipes (http://www.nrbook.com/ ), check it out.

thornahawk

unfold Re: random number generator by thornahawkthornahawk, 1246074683|%e %b %Y, %H:%M %Z|agohover
Re: random number generator
bxsciencerbxsciencer 1246076121|%e %b %Y, %H:%M %Z|agohover

thanks i think


Visit Calccrypto for info on crypto

unfold Re: random number generator by bxsciencerbxsciencer, 1246076121|%e %b %Y, %H:%M %Z|agohover
Re: random number generator
bxsciencerbxsciencer 1246120536|%e %b %Y, %H:%M %Z|agohover

arrrgggg. the site wants me to subscribe to them. im not that crazy.

so any ideas on how to write the actual equation for a good rng?


Visit Calccrypto for info on crypto

unfold Re: random number generator by bxsciencerbxsciencer, 1246120536|%e %b %Y, %H:%M %Z|agohover
Re: random number generator
bxsciencerbxsciencer 1246122397|%e %b %Y, %H:%M %Z|agohover

would it be a better idea to mess around with large but not prime numbers for randomness or mod by large prime numbers? both of them seem to work well for my program


Visit Calccrypto for info on crypto

unfold Re: random number generator by bxsciencerbxsciencer, 1246122397|%e %b %Y, %H:%M %Z|agohover
Re: random number generator
WeregooseWeregoose 1246153831|%e %b %Y, %H:%M %Z|agohover

If you'll only have one random number per run (and if the seed doesn't carry over from one generation of the program to the next), then it doesn't matter what the function is: whatever input it's given would itself have to be random in order for the expression to yield an unpredictable answer, and the randomness of that input would have to be computed somehow, ad infinitum. Where do we find that baseline element which can be measured, but not preprogrammed?

Some advanced machines can record static noise or radiation and use those for the purposes of generating random numbers. Another method is the timing of user input. Yet another approach (something that I have actually seen used in a computer program before) is where a text box appears and the user is instructed to bang on the keyboard for a few seconds. If that's not a successful RNG, then I don't know what is. (Kidding, of course.)

last edited on 1246154886|%e %b %Y, %H:%M %Z|agohover by Weregoose + show more
unfold Re: random number generator by WeregooseWeregoose, 1246153831|%e %b %Y, %H:%M %Z|agohover
Re: random number generator
bxsciencerbxsciencer 1246155593|%e %b %Y, %H:%M %Z|agohover

hahaha. i've never heard of that way before, but it sure is effective.

as for the algorithm, i guess i'll use either

E+round((3^16-10)fPart((2^16-1+E+round(fPart(((331((Sum of Original String+E))/2)/(2^32-1)))(2^32-1),0)2-E)/(3^16-10)),0→F

or

E+round((3^16+26)fPart((2^16+1+E+round(fPart(((331((Sum of Original String+E))/2)/(2^16+1)))(2^16+1),0)2-E)/(3^16+26)),0→F

but i dont know which one to chose. both are good, from what i have seen


Visit Calccrypto for info on crypto

unfold Re: random number generator by bxsciencerbxsciencer, 1246155593|%e %b %Y, %H:%M %Z|agohover
Re: random number generator
thornahawkthornahawk 1246159220|%e %b %Y, %H:%M %Z|agohover

The Second Edition of the book is freely available: http://www.nrbook.com/nr3/

thornahawk

unfold Re: random number generator by thornahawkthornahawk, 1246159220|%e %b %Y, %H:%M %Z|agohover
New post