added comments
This commit is contained in:
parent
eb3236574f
commit
5d38e038bb
@ -3,15 +3,22 @@ using System.Security.Cryptography;
|
|||||||
|
|
||||||
namespace SmallInjectorDemo
|
namespace SmallInjectorDemo
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Static helper class for generating random numbers.
|
||||||
|
/// </summary>
|
||||||
public static class RandomHelper
|
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)
|
public static int NewRandomInteger(int min, int max)
|
||||||
{
|
{
|
||||||
// The random number provider.
|
// The random number provider.
|
||||||
using (var rand = new RNGCryptoServiceProvider())
|
using (var rand = new RNGCryptoServiceProvider())
|
||||||
{
|
{
|
||||||
|
|
||||||
uint scale = uint.MaxValue;
|
uint scale = uint.MaxValue;
|
||||||
while (scale == uint.MaxValue)
|
while (scale == uint.MaxValue)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user