How to use the permutations function from mathjs

Find comprehensive JavaScript mathjs.permutations code examples handpicked from public code repositorys.

67
68
69
70
71
72
73
74
75
76
bot.command('round', 'Rounds the number to the nearest integer. Usage /round [num]', false,  (args, message) => {
    message.reply(Math.round(args[0]));
});

bot.command('permutate', 'Returns total number of objects in a permutation. Usage /permutate [num]', false,  (args, message) => {
    message.reply('permutations:' + ' ' + math.permutations(args[0]));
});

bot.command('power', 'Returns the power of a number to the other. Usage /power [num1] [num2]', false, (args, message) => {
    message.reply(Math.pow(args[0], args[1]));
fork icon2
star icon10
watch icon3

73
74
75
76
77
78
79
80
81
82

// probability
math.combinations(7, 5) // number of ways picking 'k' unordered outcomes from 'n' possibilities
math.combinationsWithRep(7, 5) // combinations with replacement
math.factorial(a);
math.permutations(n) // number of possible ordered combinations
math.pickRandom(numbers) // random selection from array
math.randomInt(0, 11) // random int (min <= x < max)

// linalg
fork icon0
star icon3
watch icon0

+ 6 other calls in file

83
84
85
86
87
88
89
90
91
92
fs.readFile(`./wordfiles/${filename}.txt`, 'utf-8', (err, data) => {
    if (err) {
        console.log(err);
    } else {
        words = data.split('\r\n');
        maxHits = math.permutations(words.length,phraseLength);
        words.forEach(function(word){
            wordAttempts[word] = 0;
        });
        PrintStatus();
fork icon0
star icon1
watch icon0