added comments

This commit is contained in:
Holger Boerchers 2018-08-12 20:21:51 +02:00
parent eb3236574f
commit 5d38e038bb

View File

@ -3,15 +3,22 @@ using System.Security.Cryptography;
namespace SmallInjectorDemo
{
/// <summary>
/// Static helper class for generating random numbers.
/// </summary>
public static class RandomHelper
{
/// <summary>
/// Return cryptographic stable random integer.
/// </summary>
/// <param name="min">Lower border of result.</param>
/// <param name="max">Upper border of result.</param>
/// <returns>Random integer.</returns>
public static int NewRandomInteger(int min, int max)
{
// The random number provider.
using (var rand = new RNGCryptoServiceProvider())
{
uint scale = uint.MaxValue;
while (scale == uint.MaxValue)
{