Rand function question

Game Editor comments and discussion.

Rand function question

Postby jimmynewguy » Tue Aug 07, 2007 9:45 pm

How do i make it where if i wanted to add a random number for it to be whole? I want a random amount of ammo 2 b picked up and i always get decimals, is there any way to do this? Plz help. THX :D
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Postby makslane » Tue Aug 07, 2007 10:38 pm

Use the round function:

Code: Select all
yourvariable = round(rand(maxvalue));
Last edited by makslane on Wed Aug 08, 2007 2:29 am, edited 1 time in total.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby pixelpoop » Wed Aug 08, 2007 2:28 am

You probably figured this out but I think makslane meant "round" not "raound".
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby makslane » Wed Aug 08, 2007 2:30 am

Thanks!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron