Elegant random string generation in Scala

Apr 7, 2012

A long long time ago… Well, maybe not that long ago… I was a Bachelor student at EPFL in Martin Odersky’s Advanced Programming class (which was really just another name for Functional Programming) learning about Scala.

We had an amazing Teaching Assistant during the exercise sessions who used to give us small extra problems to solve. One day, during the exercise session on Streams, he gave us the following task:

Can you write a function which generates a random string of length n in any given alphabet?

Continue Reading