source: node_modules/d3-random/src/uniform.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: 443 bytes
RevLine 
[e4c61dd]1import defaultSource from "./defaultSource.js";
2
3export default (function sourceRandomUniform(source) {
4 function randomUniform(min, max) {
5 min = min == null ? 0 : +min;
6 max = max == null ? 1 : +max;
7 if (arguments.length === 1) max = min, min = 0;
8 else max -= min;
9 return function() {
10 return source() * max + min;
11 };
12 }
13
14 randomUniform.source = sourceRandomUniform;
15
16 return randomUniform;
17})(defaultSource);
Note: See TracBrowser for help on using the repository browser.