Implemented weighted random selection with tests, converted RandomHelper to Scala.