-
-
Notifications
You must be signed in to change notification settings - Fork 542
Open
Description
Bogus NuGet Package
35.6.5
.NET Version
.NET 10
Visual Studio Version
No response
What operating system are you using?
Windows
What locale are you using with Bogus?
it
Problem Description
Given a static seed CodiceFiscale should generate a deterministic code, like other generators, but it doesn't. It depends on GetHashCode(), which itself is not deterministic.
LINQPad Example or Reproduction Steps
public sealed class Player
{
public required Guid Id { get; set; }
public required string FirstName { get; set; }
public required string LastName { get; set; }
public required string TaxCode { get; set; }
}
Randomizer.Seed = new Random(9612867);
var testPlayers = new Faker<Player>("it")
.StrictMode(true)
.RuleFor(x => x.Id, f => f.Random.Guid())
.RuleFor(x => x.FirstName, f => f.Name.FirstName())
.RuleFor(x => x.LastName, f => f.Name.LastName())
.RuleFor(x => x.TaxCode, f => f.Person.CodiceFiscale());
var players = testPlayers.Generate(2);Expected Behavior
Every time I run the test using this code it should produce the exact same codes.
Actual Behavior
Every run Bogus generates a different codes.
Known Workarounds
No response
Could you help with a pull-request?
Yes
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels