Skip to content

Instantly share code, notes, and snippets.

@shvahabi
Created April 17, 2023 13:04
Show Gist options
  • Select an option

  • Save shvahabi/589ebf955d7243aeb8d9b6bc1f518e1d to your computer and use it in GitHub Desktop.

Select an option

Save shvahabi/589ebf955d7243aeb8d9b6bc1f518e1d to your computer and use it in GitHub Desktop.
generate random string of desired length excluding some characters
def randomStringOfLength(length: Int): String =
scala.util.Random(java.time.Instant.now().toEpochMilli)
.alphanumeric
.filterNot("0oO1Il".toList.contains(_))
.take(length)
.mkString
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment