Together with HellMood we won this year's (2016) JS1K competition and thought this might be a good opportunity to write about the development process and my motivation behind it. If you're already familiar with JS1K, feel free to skip the next two paragraphs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'; | |
random_base64 = function random_base64(length) { | |
var str = ""; | |
for (var i=0; i < length; ++i) { | |
var rand = Math.floor(Math.random() * ALPHABET.length); | |
str += ALPHABET.substring(rand, rand+1); | |
} | |
return str; | |
} |