UNPKG

facesjs

Version:

A JavaScript library for generating vector-based cartoon faces

22 lines (21 loc) 617 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.randUniform = exports.randInt = exports.randChoice = exports.deepCopy = void 0; const deepCopy = object => { return JSON.parse(JSON.stringify(object)); }; exports.deepCopy = deepCopy; const randInt = (a, b) => { return Math.floor(Math.random() * (1 + b - a)) + a; }; exports.randInt = randInt; const randUniform = (a, b) => { return Math.random() * (b - a) + a; }; exports.randUniform = randUniform; const randChoice = array => { return array[Math.floor(Math.random() * array.length)]; }; exports.randChoice = randChoice;