source: node_modules/d3-random/src/int.js@ e4c61dd

Last change on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago

Prototype 1.1

  • Property mode set to 100644
File size: 404 bytes
Line 
1import defaultSource from "./defaultSource.js";
2
3export default (function sourceRandomInt(source) {
4 function randomInt(min, max) {
5 if (arguments.length < 2) max = min, min = 0;
6 min = Math.floor(min);
7 max = Math.floor(max) - min;
8 return function() {
9 return Math.floor(source() * max + min);
10 };
11 }
12
13 randomInt.source = sourceRandomInt;
14
15 return randomInt;
16})(defaultSource);
Note: See TracBrowser for help on using the repository browser.