Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Is there an equation that is possible where I enter a seed, and it will give me the number from the seed. I want it to give me the same results as the rand function would give with the seed as 0. I have a ti-84 calculator with the functionality of remainder() (i think that is used in random equations).

share|improve this question
    
If you want the same result as the built-in rand function then why not just use the rand function itself? –  Fixed Point Apr 16 '13 at 0:10
    
I want to understand how it works to prove that it is not true randomness because someone doesn't believe me, and thinks it is true random, which it isn't, its pseudo random –  Skyler 440 Apr 16 '13 at 0:36
    
That would be good information to add to the OP in an edit. –  The Chaz 2.0 Apr 16 '13 at 0:42
    
Well then my answer is sufficient. Multiple multiplicative linear congruential generators are combined with the factory seed of zero. Done! And machines "usually", especially if it can give you a large number of random numbers "fairly fast", use pseudorandom number generators. They can be very sophisticated and good but PRNGs nonetheless. Usually (even for cryptography) PRNGs are good enough. Otherwise I use random.org. –  Fixed Point Apr 16 '13 at 0:43
    
The post at the bottom of the page here claims to have the exact code. –  Scott H. Apr 16 '13 at 0:55
add comment

2 Answers 2

Flip the TI-84 twice. If it comes up "heads" (screen side) twice in a row, then your number is zero. If it comes up "tails" (battery side) twice in a row, then your number is one. If it comes up heads-tails or tails-heads, then redo the toss.

This will give you a random bit, meaning that if you want a number in the range 0 - 1024, you are going to need to do at least 20 flips -- at least two flips per bit.

You are going to need to make sure you throw the TI-84 from a sufficient height to ensure that the tosses are random.

share|improve this answer
    
i've already got a hole in the left bottom part of the screen from dropping it, I don't need any more damage!, and plus I could just use dice –  Skyler 440 Apr 16 '13 at 0:36
1  
+1 Hey this does work ;-) but what if he needs like 1000 random numbers...might take a while. –  Fixed Point Apr 16 '13 at 0:39
add comment

Assuming you want to replicate the built-in PRNG, this tell you exactly what you TI-84 is doing.


Edit:

Well I kind of lied. They refer to L'Ecuyer's method which points to a paper. The paper describes how to combine multiple multiplicative linear congruential generators.

Yes, the remainder function you talk about is used. A linear congruential generator is something like

$$x_{n+1}=ax_n+c \mod m$$

where $a,c,m$ are chosen judiciously. Then if $c=0$ then we have a multiplicative linear congruential generator. The thing is that (both of) these are very easily broken meaning given a sequence you can easy find $a,c,m$ and even if you aren't using them for security, they contain a lot of patterns. But they are very fast, easy to understand, and easy to program. So L'Ecuyer's paper talks about a method where you can combine a bunch of them to get a much higher quality generator.

The trouble here is I couldn't find anywhere how many MLCGs are being used in TI-84 or what the parameters are. So if you want the same exact algorithm as in TI-84, you'll probably have to break it to figure out all the parameters which might take a bit of work or some good data mining on google. Maybe someone has done something on this already.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.