Génération aléatoire d'archétype

This commit is contained in:
2026-06-20 18:38:48 +02:00
parent 749eb5ee13
commit f8a20b90ff
5 changed files with 95 additions and 27 deletions
+16 -2
View File
@@ -24,8 +24,7 @@ export class Misc {
return text.charAt(0).toLowerCase() + text.slice(1);
}
static stripHtml(html)
{
static stripHtml(html) {
const tmp = document.createElement("DIV")
tmp.innerHTML = html
return tmp.textContent || tmp.innerText || ""
@@ -329,4 +328,19 @@ export class Misc {
'-o-transform': rotation
};
}
static async random(count) {
const roll = new Roll(`1d${count}`)
await roll.evaluate()
return roll.total
}
static shuffled(source) {
const result = source.slice(0)
for (let i = result.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[result[i], result[j]] = [result[j], result[i]];
}
return result
}
}