Skip to content

Commit 3117fda

Browse files
vb-c-plicityppavlovic
authored andcommitted
000 - fix invalid array index
(cherry picked from commit f7574c4)
1 parent 1eed373 commit 3117fda

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/Probability.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ public static function isValid($value)
4040
*/
4141
public static function generateRandomWithChance()
4242
{
43-
return new static(rand(self::MINIMAL_CHANCE, self::CERTAIN));
43+
//$chances array, in getOutcome(), starts from index 0, and random can be from 1 to 100;
44+
return new static(rand(self::MINIMAL_CHANCE, self::CERTAIN) - 1);
4445
}
4546

4647
/**

0 commit comments

Comments
 (0)