MCPcopy Index your code
hub / github.com/clips/pattern / random

Function random

pattern/canvas.js:2512–2526  ·  view source on GitHub ↗
(v1, v2, bias)

Source from the content-addressed store, hash-verified

2510}
2511
2512function random(v1, v2, bias) {
2513 /* Returns a number between v1 and v2, including v1 but not v2.
2514 * The bias (0.0-1.0) represents preference towards lower or higher numbers.
2515 */
2516 if (v1 === undefined) v1 = 1.0;
2517 if (v2 === undefined) {
2518 v2=v1; v1=0;
2519 }
2520 if (bias === undefined) {
2521 var r = Math.random();
2522 } else {
2523 var r = Math.pow(Math.random(), _rndExp(bias));
2524 }
2525 return r * (v2-v1) + v1;
2526}
2527
2528function grid(cols, rows, colWidth, rowHeight, shuffled) {
2529 /* Returns an array of Points for the given number of rows and columns.

Callers 7

shuffledFunction · 0.85
k_meansFunction · 0.85
kmppFunction · 0.85
updateMethod · 0.85
_distanceMethod · 0.85
eigenvector_centralityFunction · 0.85
02-export.pyFile · 0.85

Calls 1

_rndExpFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…