Skip to content

Instantly share code, notes, and snippets.

@brianhsu
Created July 9, 2010 06:19
Show Gist options
  • Select an option

  • Save brianhsu/469128 to your computer and use it in GitHub Desktop.

Select an option

Save brianhsu/469128 to your computer and use it in GitHub Desktop.
// Port from http://gist.github.com/469067
import scala.util.Random.shuffle
import scala.math.random
def randomNickname = {
def howlong = ((random * 10) % 3 + 2).toInt
shuffle("日月天地風雷雨古龍金庸鳥山明".toList).take (howlong).mkString +
shuffle("君臣妺子".toList).head
}
/*
雨天臣
雷雨月明妺
日月子
地古子
雨雷臣
月山妺
庸龍風月君
鳥風明地君
鳥古妺
龍古臣
*/
for (i <- 1 to 10) {
println (randomNickname)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment