Question: I implemented the below RandomDate, but I always keep getting values closed to "From" date, i probably miss something here....

```
public static DateTime GetRandomDate(DateTime from, DateTime to)
    {
        var range = new TimeSpan(to.Ticks - from.Ticks);

        var rnd = new Random();

        var randTimeSpan = new TimeSpan((long)(range.TotalSeconds - rnd.Next(0, (int)range.TotalSeconds))); 

        return from + randTimeSpan;
    }

```

Answer: 
You could change to:

```
static readonly Random rnd = new Random();
public static DateTime GetRandomDate(DateTime from, DateTime to)
{
    var range = to - from;

    var randTimeSpan = new TimeSpan((long)(rnd.NextDouble() * range.Ticks)); 

    return from + randTimeSpan;
}

```

Explanation: I used `NextDouble()` because it gives a number between `0.0` and `1.0`. Your return value won't be a whole number of seconds in my solution. And I moved `rnd` out to a field on the class/struct. Because it's best to reuse one `Random` instance, and not create a new one every time one needs just one additional random number.
Fixed ArgumentOutOfRangeException:

```
public static DateTime GetRandomDateTime(DateTime? min = null, DateTime? max = null)
{
    min = min ?? new DateTime(1753, 01, 01);
    max = max ?? new DateTime(9999, 12, 31);

    var range = max.Value - min.Value;
    var randomUpperBound = (Int32) range.TotalSeconds;
    if (randomUpperBound <= 0)
        randomUpperBound = Rnd.Next(1, Int32.MaxValue);

    var randTimeSpan = TimeSpan.FromSeconds((Int64) (range.TotalSeconds - Rnd.Next(0, randomUpperBound)));
    return min.Value.Add(randTimeSpan);
}

```