Page 1 of 1

Newbie Question on integers

PostPosted: Thu Apr 29, 2004 4:48 pm
by Just4Fun
When I do this:

int iRandomInteger
iRandomInteger=49
Lotto.textNumber=(rand(iRandomInteger)+1)

I get a random float number (ie 28.549140) instead of an integer result.
What am doing wrong? TIA

PostPosted: Thu Apr 29, 2004 6:30 pm
by jazz_e_bob
You need to use:

Lotto.textNumber=round((rand(iRandomInteger)+1));

double round(double a)
Round a number to nearest integer.

PostPosted: Thu Apr 29, 2004 8:02 pm
by Just4Fun
jazz-e-bob:
I don't want to "clutter-up" the forum with a lot of non-technical items so I won't always tell you how grateful I am for your help. Still, I do like to let you know it now and again. Thank you. :lol:

PostPosted: Thu Apr 29, 2004 8:19 pm
by jazz_e_bob
understood :)

over and out :wink: