Example #1
0
        private static string GenerateIndividualNumber(Randomizer r, DataSets.Name.Gender gender, int year)
        {
            int from;
            int to;

            if (1854 <= year && year <= 1899)
            {
                from = 500;
                to   = 749;
            }
            else if (1900 <= year && year <= 1999)
            {
                from = 0;
                to   = 499;
            }
            else if (2000 <= year && year <= 2039)
            {
                from = 500;
                to   = 999;
            }
            else
            {
                throw new ArgumentOutOfRangeException(nameof(year), $"{nameof(year)} must be between 1854 and 2039.");
            }

            int individualNumber = gender == DataSets.Name.Gender.Female ? r.Even(from, to) : r.Odd(from, to);

            return(individualNumber.ToString("D3"));
        }
Example #2
0
        private static StringBuilder AppendGender(this StringBuilder builder, DataSets.Name.Gender gender)
        {
            var females = new byte[] { 0, 2, 4, 6, 8 };
            var males   = new byte[] { 1, 3, 5, 7, 9 };

            Faker f = new Faker();

            if (gender == DataSets.Name.Gender.Female)
            {
                builder.Append(f.PickRandom(females));
            }
            else
            {
                builder.Append(f.PickRandom(males));
            }

            return(builder);
        }