Skip to content

Instantly share code, notes, and snippets.

@audreyt
Forked from gugod/pw.ls
Created November 20, 2012 20:56
Show Gist options
  • Save audreyt/4121038 to your computer and use it in GitHub Desktop.
Save audreyt/4121038 to your computer and use it in GitHub Desktop.
global <<< require \prelude-ls
require! fs
dictwords = lines fs.readFileSync "/usr/share/dict/words", "utf8"
pick = (ar) -> ar[ floor Math.random() * length ar ]
pwgen = -> concatMap (-> pick dictwords), [1]*4
console.log pwgen!
@audreyt
Copy link
Author

audreyt commented Nov 20, 2012

第四列的 [rand * *] 和 Perl 6 簡直如出一轍。

@vendethiel
Copy link

also pick = (.[floor Math.random! * *]) :p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment