mirror of
https://github.com/fzaninotto/Faker.git
synced 2025-04-19 23:12:01 +02:00
randomElement accepts an array (#1993)
This commit is contained in:
parent
29e7df18de
commit
74f8b2ec6b
@ -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!";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user