CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

random number statistics

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
teekaytk



Joined: 14 Jan 2005
Posts: 28

View user's profile Send private message

random number statistics
PostPosted: Fri Sep 01, 2006 9:15 am     Reply with quote

hello
is there a way to generate a random number based on given standard deviation and variance based on normal distribution, without using extreme amounts of processing power?
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Fri Sep 01, 2006 9:29 am     Reply with quote

Yes. Generate a uniform RN (OK, pseudo-RN). Then take the RN (and depending on the distribution you are looking for, you may need more than one RN sample) and transform it into the desired distribution. Some transformations are more complicated than others and may require the use of look-up tables to avoid heavy computation.

Doesn't use that much processing power. One way to get the RNs is to use a LFSR or you could use one of several different algorithmic methods. The tranforms to go from uniform to other (Gaussain, Poisson, etc) are pretty well documented. Google should pop up several of them.

There are also some good table based methods. Simplest is to have your distribution pre-generated as a table (PDF form of the distribution I believe). Then use a LFSR to generate addresses to step into the table. Extract your value. Depending on bit depth you need you can generate the whole table or you can generate a partial table and interpolate between adjacent values. There are papers written about this technique and implementing it in FPGAs for rapid RN generation. Works pretty well but makes trade offs between speed, processing power, memory and resolution.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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


Powered by phpBB © 2001, 2005 phpBB Group