Skip to content

Instantly share code, notes, and snippets.

@maowug
Last active August 29, 2015 14:21
Show Gist options
  • Save maowug/b08d7554448794f309dc to your computer and use it in GitHub Desktop.
Save maowug/b08d7554448794f309dc to your computer and use it in GitHub Desktop.
ex3.scala
//練習問題:最初と最後の文字が同じアルファベットであるランダムな5文字の文字列を1000回出力。
new scala.util.Random(
new java.security.SecureRandom()
).alphanumeric
.grouped(5)
.withFilter { g5 => g5.head==g5.last && g5.head.toString >= "A" }
.take(10)
.foreach { vg5 => println(vg5.mkString) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment