Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
fixes #6 (Random.integer incorrect argument type) and #7 (Random.choi…
Browse files Browse the repository at this point in the history
…ce does not include last value in array)
  • Loading branch information
serjek committed Dec 23, 2017
1 parent 50c88c8 commit df203bf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/nexus/math/Random.as
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public class Random
* @param max The highest value to return, exclusive
* @return An int in the range [min, max)
*/
public function integer(min:uint = 0, max:int = int.MAX_VALUE):int
public function integer(min:int = 0, max:int = int.MAX_VALUE):int
{
return m_generator.next() % (max - min) + min;
}
Expand Down Expand Up @@ -120,12 +120,12 @@ public class Random
var choice:int;
if(items.length == 1)
{
choice = integer(0, items[0].length - 1);
choice = integer(0, items[0].length);
return items[0][choice];
}
else
{
choice = integer(0, items.length - 1);
choice = integer(0, items.length);
return items[choice];
}
}
Expand Down

0 comments on commit df203bf

Please sign in to comment.