public static async Task <int> RandomIntAsync() { try { await RandomSemaphore.WaitAsync(); return(RandomObject.Next()); } finally { RandomSemaphore.Release(); } }
public static async Task <int> RandomIntAsync(int minValue, int maxValue) { try { await RandomSemaphore.WaitAsync(); return(RandomObject.Next(minValue, maxValue)); } finally { RandomSemaphore.Release(); } }