public void NextDouble() { // no params int count = 30, minVal = 0, maxVal = 1; var nums = new List <double>(ArrayBuilder.repeat(() => GlobalRandom.NextDouble(), count)); foreach (var num in nums) { Assert.IsTrue(num >= minVal && num < maxVal); } // count nums = new List <double>(GlobalRandom.NextDoubleArr(count)); Assert.IsTrue(nums.Count == count); foreach (var num in nums) { Assert.IsTrue(num >= minVal && num < maxVal); } // count, min, max minVal = -2; maxVal = 2; nums = new List <double>(GlobalRandom.NextDoubleArr(count, minVal, maxVal)); Assert.IsTrue(nums.Count == count); foreach (var num in nums) { Assert.IsTrue(num >= minVal && num < maxVal); } }
public MultiMatrix random(int[] sizes, double minVal, double maxVal) => this.useData(GlobalRandom.NextDoubleArr(sizes.product(), minVal, maxVal), sizes);
public MultiMatrix random(int[] sizes) => this.useData(GlobalRandom.NextDoubleArr(sizes.product()), sizes);