# [[Factions and NPCs]] ## Factions ```dataview table description as "Description" from "ttrpgs/Temporary White Circle" WHERE type = "faction" SORT file.name ASC ``` ## NPCs and PCs ```dataview table description as "Description", location as "Location" from "ttrpgs/Temporary White Circle" WHERE type = "NPC" or type = "PC" SORT file.name ASC ``` ## Random NPC ```dataviewjs function randomElements(arr, n) { var result = new Array(n); var len = arr.length; if (n > len) throw new RangeError("randomElements: more elements taken than available"); for (var i = len - 1; i >= len - n; i--) { var j = Math.floor(Math.random() * (i + 1)); var temp = arr[i]; result[len - i - 1] = arr[j]; arr[i] = arr[j]; arr[j] = temp; } return result; } dv.list(randomElements(dv.pages('"ttrpgs/Temporary White Circle"') .where(b => b.type == "NPC") .where(b => !b.deceased) .sort(b => b.file.link) .map(b => b.file.link),1) ); ```