I'm currently working on a script that randomly generates loadouts for Mordhau.
I'm not worried about it calculating point values at the moment, but I would like to make it so it doesn't repeat any selected perks.
I have the perks in an array:
let perks = ["Smith","Wrecker","Scavenger","Cat","Friendly","Tenacious"]; //etc etc
And, admittedly my way of selecting them is pretty clunky but it gets the job mostly done.
let p1 = perks[Math.floor(Math.random()*(perks.length))]; //perk 1
let p2 = perks[Math.floor(Math.random()*(perks.length))]; //perk 2
let p3 = perks[Math.floor(Math.random()*(perks.length))]; //perk 3
Is there a way to assign these variables (p1, p2, p3) without any repeats from the items in the array "perks"?
Thanks in advance!