C Dapatkan pelampung acak
//random float between 0 and a
float x = (float)rand()/(float)(RAND_MAX/a);
Excited Elk
//random float between 0 and a
float x = (float)rand()/(float)(RAND_MAX/a);
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
srand(time(NULL));
float max = 1.5;
//algorithm for creating a random number
//(float cast) (float cast) (RAND_MAX) is a costant included in the lib time.h
printf("%f\n", ((float)rand()/(float)(RAND_MAX)) * max);
return 0;
}