Hello
I wrote this program to generate 256 random numbers. The numbers change each time the code is excuted. But I can't seem to limit the numbers from 1 to -1. Antother thing I can't seem to do is that I want the numbers to go up to 2 decimal placec. i.e. 1.11. I will be highly obliged if someone can point me inthe right direction.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
float i,a;
/* Set evil seed (initial seed) */
srand( (unsigned)time( NULL ) );
for (i = 0; i < 256; i++)
{
a=rand()/10000;
printf("%f\n",a);
}
return 0;
}