Skip to content

Commit 2a171ad

Browse files
committed
Update randomElements to return random number of elements when no count is provided
1 parent 029142a commit 2a171ad

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/formatters/numbers-and-strings.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,16 @@ echo $faker->randomLetter();
9292

9393
## `randomElements`
9494

95-
Returns `$count` amount of random element from the given array, traversable, or enum. By default, the `$count` parameter is set to 1.
95+
Returns `$count` amount of random element from the given array, traversable, or enum. By default, the `$count` parameter is set to a random number of elements.
9696

9797
```php
9898
echo $faker->randomElements(['a', 'b', 'c', 'd', 'e']);
9999

100-
// ['c']
100+
// ['c', 'b', 'a']
101101

102102
echo $faker->randomElements(new \ArrayIterator(['a', 'b', 'c', 'd', 'e']));
103103

104-
// ['c']
104+
// ['c', 'd']
105105

106106
enum Bar
107107
{
@@ -114,7 +114,7 @@ enum Bar
114114

115115
echo $faker->randomElements(Bar::class);
116116

117-
// ['c']
117+
// ['c', 'a']
118118

119119
echo $faker->randomElements(['a', 'b', 'c', 'd', 'e'], 3);
120120

0 commit comments

Comments
 (0)