CEMETECH
Leading The Way To The Future
Login [Register]
Username:
Password:
Autologin:

Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 102 users online: 3 members, 73 guests and 26 bots.
Members: Pizzaboy.
Bots: Spinn3r (1), MSN/Bing (1), Magpie Crawler (3), Googlebot (19), MSN/Bing (2).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
Author Message
Spenceboy98


Super-Expert


Joined: 06 Jan 2012
Posts: 825
Location: In the TARDIS

Posted: 30 Jan 2012 05:00:02 pm    Post subject: randInt( Problems

Whenever I try to use the "randInt(" command on my TI-84+ SE it says, "ERR:OVERFLOW". It worked fine before. I don't know what is wrong. Help would be appreciated!
_________________
DERSH IMPERSHIBER!
Back to top
Tari


Systems Integrator


Joined: 03 Jul 2006
Posts: 2113
Location: Always-winter, Michigan

Posted: 30 Jan 2012 05:01:01 pm    Post subject:

When in doubt, try reseeding the RNG.

Code:
0->rand

_________________


Ask questions the smart way · タリ
Back to top
elfprince13


OVER NINE THOUSAND!


Joined: 23 May 2005
Posts: 10234
Location: A galaxy far far away......

Posted: 30 Jan 2012 05:03:57 pm    Post subject:

Can you give us an example of a line you are executing that is causing the problem?

Tari wrote:
When in doubt, try reseeding the RNG.

Code:
0->rand


Keep in mind that whenever you issue this command, your "random" numbers will follow the same sequence.
_________________
StickFigure Graphic Productions || VSHI: Vermont Sustainable Heating Initiative


Back to top
Spenceboy98


Super-Expert


Joined: 06 Jan 2012
Posts: 825
Location: In the TARDIS

Posted: 30 Jan 2012 05:06:06 pm    Post subject:

Thanks! It works now!
_________________
DERSH IMPERSHIBER!
Back to top
Sorunome


Expert


Joined: 22 Feb 2011
Posts: 636
Location: Somewhere out there

Posted: 31 Jan 2012 05:26:55 am    Post subject:

Tari wrote:
When in doubt, try reseeding the RNG.

Code:
0->rand
What does that exactly do? Does it somehow say out of which number the "random" numbers are calculated?
_________________



Back to top
Ashbad


... I think redheaded girls are kind of cool


Joined: 01 Dec 2010
Posts: 2418
Location: Stomp Stomp Stomp, The Idiot Convention

Posted: 31 Jan 2012 07:49:19 am    Post subject:

Sorunome wrote:
Tari wrote:
When in doubt, try reseeding the RNG.

Code:
0->rand
What does that exactly do? Does it somehow say out of which number the "random" numbers are calculated?


Simpler random number generators work by starting with a certain number, and then each time you want a new random number, it'll do something like multiply the number by some arbitrary number (like .123456789 or .54321876) and then add another arbitrary number to it (again, like .12345), and will then consider that "random". When you re-seed the generator, you get the same sequence of results every time you use rand because it starts with the same number as the seed, and multiplies/adds the random numbers on top the same each time. The trick is to start with something rather naturally random as the seed, like a Timer ID/ Timer Status, and then don't reseed it more often than you need to (if at all).
_________________
-Ashbad
Back to top
Travis


Advanced Member


Joined: 03 Feb 2011
Posts: 215
Location: Kansas, USA

Posted: 31 Jan 2012 08:02:20 am    Post subject:

It's also useful for experiments or debugging where you want to be able to reuse the same PRNG sequence on multiple trials—just use the same seed again.

I remember the “overflow” problem being mentioned frequently back in the TI-82/85 ASM days after people would run certain programs. I guess the seed value in RAM would get corrupted and cause the error until the seed was manually reset to a valid value.
_________________
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55764
Location: Earth, Sol, Milky Way

Posted: 31 Jan 2012 08:10:23 am    Post subject:

Travis wrote:
I remember the “overflow” problem being mentioned frequently back in the TI-82/85 ASM days after people would run certain programs. I guess the seed value in RAM would get corrupted and cause the error until the seed was manually reset to a valid value.
Exactly this. I've never quite understood why the OS doesn't choose to reset the rand seed to a sane value if it's a non-number; either TI's engineers didn't think to catch and handle that error, or they decided it would be the least confusing behavior since you might not suddenly expect your rand to be reseeded.
_________________


Back to top
Weregoose


Cemetech Expert


Joined: 23 Oct 2009
Posts: 463

Posted: 31 Jan 2012 07:40:46 pm    Post subject:

To mimic seeding rand:

PROGRAM:RANDSEED
:abs(int(Ans→X
:2^31-{85,249→u(nMin)
:4E4+{14,692→v(nMin)
:{XAns(1),X
:15{823,4526}not(X)+Ans-u(nMin)int(Ans/u(nMin)→w(nMin)

To mimic rand:

PROGRAM:RAND
:v(nMin)w(nMin)
:Ans-u(nMin)int(Ans/u(nMin)→w(nMin)
:fPart(1-min(ΔList(Ans/u(nMin)

This is good up to and including X=109-1. Why the native variety takes a different course is anyone's guess.
_________________
Common Errors in English · How To Ask Questions The Smart Way
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are GMT - 5 Hours

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.030930 seconds.