I created an extension method for the the class Random
which executes an Action
(void delegate) at random times:
public static clas
Is using Thread.Sleep
bad? Generally not, if you really want to suspend the thread. But in this case you don't want to suspend the thread, you want to suspend the task.
So in this case, you should use:
await Task.Delay(minDuration);
This will not suspend the entire thread, but just the single task you want to suspend. All other tasks on the same thread can continue running.