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 CCS Technical Support

RAND() Algorithm

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



Joined: 03 Dec 2008
Posts: 184
Location: Gresham, OR USA

View user's profile Send private message Send e-mail Visit poster's website

RAND() Algorithm
PostPosted: Wed Mar 25, 2009 12:15 pm     Reply with quote

Does anyone know the algorithm CCS uses for its rand() pseudo random number generator?

Also, stdlib.h defaults the RAND_MAX to 32767. Is this the maximum allowed value?

Currently using CCS version 4.084.

Thanks.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Mar 25, 2009 12:30 pm     Reply with quote

The source code for the function is in stdlib.h. Just search for this line
near the end of the file and you'll see the code:
Quote:
// The random number implementation


File location:
Quote:
c:\Program Files\picc\Drivers\stdlib.h
jgschmidt



Joined: 03 Dec 2008
Posts: 184
Location: Gresham, OR USA

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Wed Mar 25, 2009 12:37 pm     Reply with quote

Right under my nose... thanks.
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