How to use the random function from bignumber.js
Find comprehensive JavaScript bignumber.js.random code examples handpicked from public code repositorys.
30 31 32 33 34 35 36 37 38 39 40
} // Override baseGeneration.generateUniform = function (test, options, max) { max = determineMax(test, options.party_count, options.integer_digits, options.decimal_digits, max); var wholeNum = BigNumber.random().times(max).floor(); var deciNum = wholeNum.div(new BigNumber(10).pow(options.decimal_digits)); return Math.random() < 0.5 ? deciNum : deciNum.times(-1); }; baseGeneration.generateNonZeroUniform = function (test, options, max) {
0
0
0
+ 4 other calls in file
68 69 70 71 72 73 74 75 76 77
}; baseGeneration.generateMultiple = function (test, options, max, factor) { max = determineMax(test, options.party_count, options.integer_digits, 0, max); var nmax = max.div(factor).abs().floor(); max = nmax.gt(max) ? max : nmax; var coef = BigNumber.random().times(max).floor(); return coef.times(factor); }; baseGeneration.generateDividend = function (test, options, max, divisor) { var max1 = determineMax(test, options.party_count, options.integer_digits, options.decimal_digits, max);
0
0
0
+ 4 other calls in file
bignumber.js.BigNumber is the most popular function in bignumber.js (869 examples)