Thread: Random Numbers
View Single Post
  #1   Spotlight this post!  
Unread 18-01-2004, 20:29
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Question Random Numbers

Anybody know how to Generate a random number?

If you check the pdfs that came with the compiler (CD:\mcc18\doc\MPLAB-C18-Libraries.pdf), there is a random number type thing, but I can't use it!

Here:

//Prototype
int rand(void);

//...

/****************************************
* FUNCTION NAME: Random
* PURPOSE: Returns a random char
* CALLED FROM: Where ever
* ARGUMENTS: none
* RETURNS: unsigned char
****************************************/
unsigned char Random(void)
{
unsigned int rnd;

rnd = Rand;

rnd = rnd / RAND_MAX;
return (unsigned char) (rnd & 0xFF);
}

The thing is, When I build, I get
...\user_routines.c:267:Error [1105] symbol 'Rand' has not been defined

Help?!?