Question: > 
> **Possible Duplicates:**  
> 
> [How to generate a random number in C?](https://stackoverflow.com/questions/822323/how-to-generate-a-random-number-in-c)  
> 
> [implementation of rand()](https://stackoverflow.com/questions/1167253/implementation-of-rand)  
> 
> [Generating random terrain in Blender3D](https://stackoverflow.com/questions/31834/generating-random-terrain-in-blender3d) 
> 
> 
> 

I need high quality random numbers in C, but I have no idea what to really do. I need to be able to get numbers from 1-100. Any help or maybe point me to where I can find help.

Answer: 
You can try something like this:

```
main()
{
  srand(time(0));

  for(int i=0;i<1000;++i)
    printf("%f ", ((float)rand())/RAND_MAX*99+1);

  return 0;
}

```

It's as uniform a distribution as the standard rand() can give.
The other posts have good advice. If you really want to dive into the guts of random number generation, take a look at [Numerical Recipes in C](http://www.nrbook.com/a/bookcpdf.php). Start with [Chapter 7](http://www.nrbook.com/a/bookcpdf/c7-0.pdf).