Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

LaraBABA's avatar

Fake factory help with randmon number

Hello,

I am not able to find out how to generate a random number with a range using faker: 'town_id' => $faker->numberBetween($min = 1, $max = 115),

Does anyone knows the equivalent please? I would have thought that the above function would have worked based on this link: https://packagist.org/packages/fzaninotto/faker

numberBetween($min = 1000, $max = 9000) // 8567 <-----------

Thank you.

0 likes
1 reply
LaraBABA's avatar

Ended up using normal php $random = rand(1,115))...

1 like

Please or to participate in this conversation.