question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Managing randomness with faker is impossible

See original GitHub issue

In 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:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:19 (6 by maintainers)

github_iconTop GitHub Comments

6reactions
chongkimcommented, Jan 25, 2018

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.

2reactions
chongkimcommented, Dec 12, 2017
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found