Skip to content

Instantly share code, notes, and snippets.

@volgar1x
Last active December 22, 2015 01:39
Show Gist options
  • Save volgar1x/6398116 to your computer and use it in GitHub Desktop.
Save volgar1x/6398116 to your computer and use it in GitHub Desktop.
package org.photon.common
import java.util.Random
object Strings {
val alphanum = 'a' to 'z'
def rand(implicit rnd: Random): Char = alphanum(rnd.nextInt(alphanum.length))
def rand(n: Int)(implicit rnd: Random): String = (0 to n).foldLeft("") { (res, _) => res + rand }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment