6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Mon Jun 10, 2024 1:26 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: random number generation
PostPosted: Fri Jan 03, 2003 5:07 am 
Offline
User avatar

Joined: Sun Dec 29, 2002 8:56 pm
Posts: 449
Location: Canada
hi,

I was just wondering how random numbers are generated ? I am using EnhBASIC to display patterns on a text screen but the patterns don't seem very random. I'm wondering if this is a problem with hardware or is it a built in feature of EnhBASIC ?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jan 03, 2003 11:59 pm 
Offline

Joined: Fri Aug 30, 2002 2:05 pm
Posts: 347
Location: UK
Hi Rob,

The RND() function in EhBASIC uses a 31 bit maximal length PRNG.

I chose this for two reasons - speed, and it ensures all the values
will eventually be produced.

If you want a more random seeming sequence then use every nth
value (where n is a suitable large prime number). EhBASIC68k
uses every 5th value to this end.

Lee.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


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 post attachments in this forum

Search for:
Jump to: