Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diffierent value if recall values #1075

Closed
Kieaer opened this issue Jan 29, 2024 · 2 comments
Closed

Diffierent value if recall values #1075

Kieaer opened this issue Jan 29, 2024 · 2 comments

Comments

@Kieaer
Copy link

Kieaer commented Jan 29, 2024

Describe the bug
Same title

To Reproduce

Faker faker = new Faker();
for (int i = 0; i < 10; i++) {
    System.out.println(faker.company().name());
}
Faker faker = new Faker(new Random(0));
for (int i = 0; i < 10; i++) {
    System.out.println(faker.company().name());
}

Expected behavior
Print same values

Versions:

  • OS: Windows 11
  • JDK 17
  • Faker Version 2.1.0

Additional context
None.

@Kieaer Kieaer changed the title Diffierent value if call company Diffierent value if recall values Jan 29, 2024
@kingthorin
Copy link
Collaborator

kingthorin commented Jan 29, 2024

If you want consistent values you have to provide a consistent seed.

By default and design data faker is made to generate data, not consistent data. Hence providing the option for users to provide a consistent seed and get consistent data.

@bodiam
Copy link
Contributor

bodiam commented Jan 29, 2024

I'm not sure what you mean with "print same values", but the second example should print the same output on every run. The first one won't, since you create a faker with a random seed. Please provide more info if you think this is still an issue.

@bodiam bodiam closed this as completed Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants