Skip to content

Instantly share code, notes, and snippets.

@schas002
Last active September 22, 2017 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schas002/fb2421a0158c199c99c79cd5df673a75 to your computer and use it in GitHub Desktop.
Save schas002/fb2421a0158c199c99c79cd5df673a75 to your computer and use it in GitHub Desktop.
const Chance = require('chance');
const argv = require('yargs').argv;
const chalk = require('chalk');
let seed;
if(typeof argv.seed === 'undefined') {
seed = Math.floor(Math.random() * Math.pow(2, 32));
} else {
seed = argv.seed;
}
let rn = new Chance(seed);
console.log(chalk`{yellow Prompt generated ${new Date().toISOString()}}`);
console.log(chalk`{cyan Verifiable seed: ${seed}}`);
let categories = argv.c;
console.log(chalk`Pick from ${categories.length} categories: {bold ${rn.pickone(categories)}}`);
let min = argv.a; let max = argv.b;
console.log(chalk`Pick between ${min} and ${max}: {bold ${rn.integer({min, max})}}`);
console.log(chalk`{cyan mkprompt from https://gist.github.com/schas002/fb2421a0158c199c99c79cd5df673a75}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment