public void main() { Console.Write("Sectio Two" + " \n Testing Blum Blum Shub Numbers : " + blumBlumShub.Next(100) + " , " + blumBlumShub.Next(100) + " , " + blumBlumShub.Next(100) + ".\n Testing Random Shuffle : " + blumBlumShub.Next(100) + " , " + blumBlumShub.Next(100) + " , " + blumBlumShub.Next(100) + ".\n Testing unique value for permutation at index 5 : " + generatePermutationUnqiueNumber(5) + "\n ChiTest Value " + chiSquareTest()); }
public ILandscape Generate(ILandscape input, IParameterProvider paramProvider) { var pointsCount = paramProvider.Get <int>("num"); var width = paramProvider.Get <int>("w"); var height = paramProvider.Get <int>("h"); var rng = new BlumBlumShub(DateTime.Now.Ticks); return(new ImmutableLandscapeBuilder() .SetWidth(width) .SetHeight(height) .SetPoints( Enumerable.Range(0, pointsCount) .Select(x => new Point(rng.Next(width), rng.Next(height))) .ToList() ) .Build()); }
private int[] generateArray(int arraySize) { var r = new Random(); BlumBlumShub s = new BlumBlumShub(); int[] array = new int[arraySize]; for (int i = 0; i < array.Length; i++) { long[] randomNumbers = { s.Next(100), s.Next(100), s.Next(100), s.Next(100), s.Next(100), s.Next(100), s.Next(100), s.Next(100), s.Next(100), s.Next(100), s.Next(100), s.Next(100) }; int min = (int)randomNumbers[0]; for (int a = 1; a < randomNumbers.Length; a++) { if (randomNumbers[a] < min) { min = (int)randomNumbers[a]; } } array[i] = min; } return(array); }
private static void TestBlumBlumShub() { RandomNumberGenerator rng = new BlumBlumShub(12); var nums = new int[10]; for (int i = 0; i < 10; i++) { nums[i] = rng.Next(1, 100); } for (int i = 0; i < 10; i++) { Console.WriteLine(nums[i]); } }