Skip to content

Commit

Permalink
randomElement accepts an array (fzaninotto#1993)
Browse files Browse the repository at this point in the history
  • Loading branch information
reed-jones authored and GrahamCampbell committed Oct 27, 2020
1 parent 95551b5 commit d84730c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ print_r($values); // [0, 4, 8, 4, 2, 6, 0, 8, 8, 6]
// just like unique(), valid() throws an overflow exception when it can't generate a valid value
$values = array();
try {
$faker->valid($evenValidator)->randomElement(1, 3, 5, 7, 9);
$faker->valid($evenValidator)->randomElement([1, 3, 5, 7, 9]);
} catch (\OverflowException $e) {
echo "Can't pick an even number in that set!";
}
Expand Down

0 comments on commit d84730c

Please sign in to comment.