Managing randomness with faker is impossible
See original GitHub issueIn the case when the fields are specified over faker providers, it’s impossible to manage randomness because order of evaluation is not fixed (iterating a dict internally?). Example: Seed the random before of instantiation of
class CompanyFactory(factory.DjangoModelFactory):
class Meta:
model = Company
name = faker.company
status = 'APR'
with
import factory
faker = factory.faker.Faker._get_faker(locale='de_DE')
faker.random.seed(0)
returns the same result. But adding any other fuzzy field, for instance:
faker.phone_number
makes both fields to be filled in an unpredictable way. Maybe because the fields are evaluated in the dict iteration. It would be nice to have a work around at least.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:19 (6 by maintainers)
Top Results From Across the Web
Elegant and readable randomness using Faker - Medium
Our generation logic is now readable, concise and explicit. · The quality of the data is much better than before. · Generated values...
Read more >Fake (almost) everything with Faker | by Sunny Srinidhi
I was recently tasked with creating some random customer data, with names, phone numbers, addresses, and the usual other stuff.
Read more >How FAKER STOMPS MID in 3 Minutes - LoL Midlane Guide
JOIN THE BLACK FRIDAY SALE AT 50% OFF:▻ https://www.gameleap.com/BLACK50?c=cmpgn_wlPZLlOXR^ ENDS TODAY, JOIN NOW ^▻ Connect with us on ...
Read more >Why is it impossible for a computer to generate a truly random ...
Within the computer, numbers cannot ever be truly random. So typically, some real-world source of randomness (For example, the low order bits of...
Read more >Quantum random number generation | npj Quantum Information
Quantum physics can be exploited to generate true random numbers, ... randomness is generally considered impossible with only classical ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve made a PR. I noticed that some PR are years old. What do I need to do to get this into master? I’d hate to have it sit around for some step I neglected to do.
I’ve fixed the problem in https://github.com/FactoryBoy/factory_boy/pull/438