Last active
August 29, 2015 14:15
-
-
Save atqamar/dfbb4a76e6c45d52e359 to your computer and use it in GitHub Desktop.
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
import scala.util.Random | |
import scala.collection.mutable | |
val data = List(List("t1", "ar1", "al1"), // track 1 and corresponding artist, album | |
List("t2", "ar2", "al2"), // 2 '' | |
List("t3", "ar3", "al3"), // 3 '' | |
List("t4", "ar4", "al4"), // 4 '' | |
List("t5", "t5", "al5"), // 5, the artist is missing so we randomly picked track in its place | |
List("t6", "ar6", "ar6")) // 6, the album is missing so we randomly picked artist in its place | |
// This outputs the three CJ randomized of input playlist | |
val output = data | |
.map( l => Random.shuffle(l) ) | |
.transpose | |
.map(_.mkString(" ")) | |
.to[mutable.ListBuffer] | |
val buggy = "1" | |
if (buggy == "1") | |
output ++= List("I am buggy") | |
output // return output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment