random number decimals

Game Editor comments and discussion.

random number decimals

Postby 157pl » Mon Mar 14, 2011 3:30 am

is it possible to create a random number with decimals
i cant seem to get it to work
User avatar
157pl
 
Posts: 109
Joined: Thu May 13, 2010 10:49 pm
Location: AZ
Score: 3 Give a positive score

Re: random number decimals

Postby skydereign » Mon Mar 14, 2011 5:41 am

rand() gives a random decimal. Just make sure you aren't using an int to hold that value. A simple way to demo this is create a text actor. In its create actor event, use this.
Code: Select all
textNumber=rand(1);
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: random number decimals

Postby 157pl » Mon Mar 14, 2011 6:29 am

apparently i forgot to change my variable to a real
thanks for the help
User avatar
157pl
 
Posts: 109
Joined: Thu May 13, 2010 10:49 pm
Location: AZ
Score: 3 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron