Last active
August 29, 2015 14:21
-
-
Save maowug/b08d7554448794f309dc to your computer and use it in GitHub Desktop.
ex3.scala
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
//練習問題:最初と最後の文字が同じアルファベットであるランダムな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