Answers for "c# generate random date of birth but over 18"

C#
0

c# generate random date of birth but over 18

private Random gen = new Random();
DateTime RandomDay()
{
    DateTime start = new DateTime(1995, 1, 1);
    int range = (DateTime.Today - start).Days;           
    return start.AddDays(gen.Next(range));
}
Posted by: Guest on April-16-2021

C# Answers by Framework

Browse Popular Code Answers by Language