0

Hey,

I was doing some coding for fun, just practicing and seeing if i could still all the sorts and searches. My question is unrelated to that however because i can't seem to figure out an easy way to generate random char arrays.

i found a random() function in the man pages.

long int random(void) which generates a random number between 0 and MAX_RAND.

Does anyone have any ideas on how to get this to give me values between 33-127 ( the printable ASCII values)?

My function so far is

```
int randomChar()
{
double rnd;
double max = MAX_RAND; //i did this to cast the MAX_RAND (int) to a double
rnd = random();
return (rnd/max)*127 - (rnd/max)*33;
}
```