Generating a random number using easy c

I want to generate a random number that ranges from 0 to 1 and set it to a variable. Is there a way to do this using easy c v2?

I want the number to change every time the program loops.

Thank you in advance.

Are you looking for a FLOAT (non-whole number) or a Integer?

The random number generator is under Math->Misc->Random Number

To generate a 1 or 0 then just configure it to do so.

If you want a floating point number set a floor of 0 and a ceiling of 100 and then divide by 100. You will need to cast it though so make sure you do that.

declare a local variable: float myRandomPercent = 0;
call the random generator
then make an assignment myRandomPercent = (float)(randomInt / 100);

thank you, but I thought specified on easy c v2 now that I looked at my post again, I see that I didnt. I’ll edit my post.

I am looking for a floating point number.

Goto the options menu -> File Inclusion
add: <stdlib.h>

create a float called random preset it to 0;

User Code

random = (rand() % 100) / 100; //% 100 creates a random 1 - 100. 

the variable random will return 0.0 to 1.0