Jump to content


Photo

irandom_range clarification


  • Please log in to reply
3 replies to this topic

#1 drewradley

drewradley

    GMC Member

  • New Member
  • 140 posts

Posted 05 January 2011 - 07:04 PM

If I am reading the wiki correctly and I wanted to "roll" a six sided die I would use "irandom_range(1,7)" not (1,6) since if I used (1,6) it would never roll a 6. Is this correct?
  • 0

#2 YellowAfterlife

YellowAfterlife

    GMC Member

  • Global Moderators
  • 3497 posts
  • Version:GM:Studio

Posted 05 January 2011 - 07:11 PM

irandom_range(x1,x2) Returns a random real number between x1 (inclusive) and x2 (inclusive). Both x1 and x2 must be integer values (otherwise they are rounded down).

- manual says. listen to it. irandom(1,6) would return 1,2,3,4,5, or 6.
  • 0

#3 drewradley

drewradley

    GMC Member

  • New Member
  • 140 posts

Posted 05 January 2011 - 07:18 PM

irandom_range(x1,x2) Returns a random real number between x1 (inclusive) and x2 (inclusive). Both x1 and x2 must be integer values (otherwise they are rounded down).

- manual says. listen to it. irandom(1,6) would return 1,2,3,4,5, or 6.


Thanks! Guess I shouldn't rely solely on the wiki since it says x2 is EXCLUSIVE:

Description

The irandom_range() function in Game Maker returns a random integer value between x1 (inclusive) and x2 (exclusive).


http://wiki.yoyogames.com/index.php/Irandom_range
  • 0

#4 Davido01

Davido01

    GMC Member

  • New Member
  • 905 posts

Posted 05 January 2011 - 07:24 PM


irandom_range(x1,x2) Returns a random real number between x1 (inclusive) and x2 (inclusive). Both x1 and x2 must be integer values (otherwise they are rounded down).

- manual says. listen to it. irandom(1,6) would return 1,2,3,4,5, or 6.


Thanks! Guess I shouldn't rely solely on the wiki since it says x2 is EXCLUSIVE:

Description

The irandom_range() function in Game Maker returns a random integer value between x1 (inclusive) and x2 (exclusive).


http://wiki.yoyogames.com/index.php/Irandom_range


Wiki is fixed. ;)
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users