Random Words

Random Words is a small program that chooses random entries from YAWL, a public domain list of 264,097 English words.

Implementation

Random Words is written in JavaScript and runs in the browser. To avoid the need to fetch the whole 2.7 MB YAWL word.list file, I've converted word.list into a table where each word is padded with spaces to 45 characters, the length of the longest word in the list.

The program uses the getRandomValues() function to generate a random number in the range [0, 264097) to select a word, then uses the HTTP Range header to fetch only that word from the table.