mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-20 09:22:49 +03:00
14 lines
378 B
JavaScript
14 lines
378 B
JavaScript
|
const {faker} = require('@faker-js/faker');
|
||
|
|
||
|
/**
|
||
|
* Adds another degree of randomness into some decisions
|
||
|
* @param {number} lowerThan Only this % of people will achieve this luck
|
||
|
* @returns {boolean} Whether this person is lucky enough for the condition
|
||
|
*/
|
||
|
const luck = lowerThan => faker.datatype.number({
|
||
|
min: 1,
|
||
|
max: 100
|
||
|
}) <= lowerThan;
|
||
|
|
||
|
module.exports = {luck};
|