Hello, I’ve found next code for random numbers generation and there are something that I don’t understand: ¿What does mean 1.e6?
Sorry for my ignorance.
#include <stdio.h>
main(){
int i;
float seed;
float rand(float);
printf("
Enter an odd 6 digit number not ending in 5: ");
scanf("%f", &seed);
for(i = 0; i < 10; i++){
seed = rand(seed);
printf("
%14.6f", seed);
}
}
Someone knows how to generate random floats?
float rand(float x){
int i;
i = 997.0 * x / 1.e6;
x = 997.0 * x - i * 1.e6;
return x;
}