📜  c# 生成随机出生日期但超过 18 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:48.984000             🧑  作者: Mango

代码示例1
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));
}