Sortition Lists

Senate Sortition

A new, completely random sortition for the Senate, generated every day

Today's Sortition

Selections for 2024-03-19
Seed: 42b3490625d5b640cb975ca09dd1803e
  1. MutluMali
  2. Akomine

Generated at: 2024-03-19 at 00:01:03 UTC

Previous Sortitions

How does this work?
Every day, just after midnight UTC, this script will generate a new ordered list of sortition selections for the day. It does this in the following steps:
  1. The current sortition list on the forums is captured, and the available names extracted (excluding any removed Senators). This produces an unsorted list
  2. A completely random file is downloaded from random.org, which is generated daily using unpredictable atmospheric noise. This file forms the basis of the randomization
  3. In order to make that file useful, the MD5 hash of the file is taken, producing a 32-character string. This is the seed for the day
  4. Using the day's seed, a random order of numbers is produced on random.org, from 1 to n, where n is the total number of candidates. The day's seed is a persistent identifier, to ensure a random but reproducible sequence
  5. Finally, the random order is applied to the sortition list to produce the sortition selections for that day; a sorted list in descending order starting with the 1st selection. If there is a selection occurring that day, and your name is first on the list, congratulations, you have been selected! Selection lists can be viewed every day at the top of this page
To avoid any strategic filling of vacancies, any time the sortition of new Senators is initiated by choice or vote, the selection shall occur on the following calendar day UTC

For Full Transparency: Sortition selection is auditable by anyone. This script runs automatically, and stores a copy of the day's sorted list of sortition selections for future use. All previous day's lists can be searched using the tool above. For the interests of transparency, the code behind this page is displayed below. It is written in PHP, though any language can work, or this method can be performed manually. The current day's random file is available to download from random.org, and they provide a free torrent every month containing all the archived files.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
 * Grabs the most up-to-date sortition list from the Forums
 * This is a weird xpath query on a specific forum post, it could break easily if anything changes server-side
 * The code looks complicated, but basically it just takes every plain-text line in the first post in the thread and adds it to the array
 * Eg: bold or coloured text won't be counted, but plain text will. That way we can make it look nice while also being machine readable
 * */
$dom = new DOMDocument;
@$dom->loadHTMLFile('http://www.villagecraft-server.com/forum/index.php?topic=5278.0');
$xpath = new DOMXpath($dom);
$content = $xpath->query("//*[@id=\"quickModForm\"]/div[1]/div/div[2]/div[2]/div")[0]->childNodes;
$list = array();
foreach ($content as $node) { if($node->tagName == null) { array_push($list, $node->textContent); } }
$size = count($list);



/**
 * Determines what "today" is, and gets today's Pregenerated File Archive from random.org
 * Note, the PFA is only downloadable for the current day. A torrent is provided on a monthly basis for previous files
 */
$today = date("Y-m-d");
$PFA = "https://archive.random.org/download?file=$today.bin";

/* Gets the seed, which in our case is an MD5 sum of the PFA from above */
$seed = md5(file_get_contents($PFA));

/* Gets a random sequence from 1 to n from random.org, using the seed, to sort the array by */
$order = explode("\n", file_get_contents("https://www.random.org/sequences/?min=1&max=$size&col=1&format=plain&rnd=id.$seed"));

/* Then we sort the list with that order, putting everyone in their new position */
$randomList = array();
foreach($list as $index=>$user) { $randomList[intval($order[$index])] = $list[$index]; }
ksort($randomList);