Newbie Question on integers

Non-platform specific questions.

Newbie Question on integers

Postby Just4Fun » Thu Apr 29, 2004 4:44 pm

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
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Re: Newbie Question on integers

Postby BloodRedDragon » Sat Jan 17, 2009 10:27 pm

you may need to get rid of the rand as it may be a random decimal. Or you may have to multiply, as what you have done in the script is divided the rand by the integer.
Current projects:
Techno-Tank Arena: on hold
Techno-Tank SuperPortal (working title): 0.1%
Bowels of Galaxies: 35% (was a bit too optimistic)
User avatar
BloodRedDragon
 
Posts: 123
Joined: Tue Jan 29, 2008 10:07 pm
Location: The Underworld
Score: 5 Give a positive score

Re: Newbie Question on integers

Postby Fuzzy » Sun Jan 18, 2009 12:01 pm

And what you've done is answer a five year old question!

:)
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron