Skip to content

Instantly share code, notes, and snippets.

@scotthmurray
Created January 23, 2013 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scotthmurray/4610744 to your computer and use it in GitHub Desktop.
Save scotthmurray/4610744 to your computer and use it in GitHub Desktop.
A simple JavaScript interpretation of the title of this book: https://mitpress.mit.edu/books/10-print-chr2055rnd1-goto-10-0 (Not as elegant as the original, I know.)
var numTimes = 100;
var r = "";
var c = function() {
var rand = Math.random(0, 1);
if (rand < 0.5) {
return "/";
} else {
return "\\";
}
}
for (var i = 0; i < numTimes; i++) {
r = r + c();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment