Allocate by chance: random selection and allocation list
In brief
The tile draws a simple random sample from a list (numbers 1 to N or a pasted list with one ID per line) or distributes people to groups: with block randomisation (ratio of the groups, several block sizes, optionally separate by strata) or with fixed group sizes. Every list can be saved as CSV or copied.
A teaching tool, not a real study randomisation
The seed is visible. Anyone who knows it and the method can calculate the whole list in advance; there is no concealed allocation and no protocol. A real study needs an approved system, an independent person and the protocol of the institution. That is why every exported file begins with the line “Teaching tool - not for real studies (no concealment)”, the seed and the method.
Seed
The default is 20261008. The same seed and the same inputs give the same list; a different seed gives a different one. The seed never comes from the clock. With strata every stratum has a stream of its own (number of the stratum from 1): the list of a stratum does not change when another stratum becomes larger.
Blocks
- A block contains each group as often as the ratio requires (with 1:1 and block size 4 twice each), in random order. After every complete block the groups are exactly balanced; in between they differ by at most half the block size.
- Anyone who knows the block size can guess the last case of every block. That is why several block sizes are mixed; the block numbers in the table show where a block ends.
- The last block can remain incomplete; the groups are then not exactly equal at the end. With “Keep the last block complete” the list becomes longer than the number of places.
- Many small strata have many incomplete blocks.
Concealed mode: person by person
- The whole list is created at the start from the browser's randomness (not from a seed) and is not shown. Each person gets their group only when their ID is entered; this cannot be taken back, and each ID counts only once.
- The fingerprint (SHA-256 of a salt and the list) commits to the list. It belongs in the study protocol before the first enrolment. At the end the list is disclosed together with the salt; anyone who recalculates the fingerprint sees that nothing was changed afterwards.
- Limit: the list is concealed only from a look at the screen. Anyone who opens the browser's developer tools can read it, and anyone who clears the browser storage loses the run. The log should therefore be saved during enrolment. A real study needs an approved system in which the person who enrols never sees the list.
Selection from a list
The IDs are only displayed and never inserted into a command; the list stays in the browser. Duplicate IDs are not removed (otherwise a person would have a double chance) but reported; empty lines are skipped. Limits: at most one million lines of at most 200 characters each. A selection picks people, an allocation distributes them to groups; these are two different steps.
For specialists
Generator mulberry32 (32 bit) with mixed substreams from (seed, number). Shuffling after Fisher-Yates; the selection swaps only k places, so a million lines cost almost nothing. The methods are defined, not “correct” in comparison with a standard: another generator would give other lists. The properties are tested (every complete block balanced, difference at most half the block size, equal inclusion frequency, equal frequency of the six arrangements of a 1:1 block of size 4 for fixed seeds) as well as lists that were produced in the script with a rebuild of the generator in R.