Created
April 11, 2018 20:31
-
-
Save rssh/bfd3bc550ef33502641a783e545d9697 to your computer and use it in GitHub Desktop.
Winner of SalaDays tickets Raffle
This file contains 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
package X | |
import scala.util.Random | |
object ScalaDaysRaffle | |
{ | |
val participants = Seq( | |
"Andrey Parhomenko" -> "http://github.com/team3", | |
"Yurii Khomenko" -> "https://github.com/yurii-khomenko", | |
"Victor Moskvych" -> "https://github.com/wouzar", | |
"Anastasiia Kharchenko" -> "", | |
"Artur Zhurat" -> "https://github.com/azhur", | |
"Victor Vasiliv" -> "https://github.com/Vict0rynox" | |
) | |
val extraSalt=0 // last number in comments for FB post before 00:00:00 Apr. 12 if will be any | |
val seed = participants.map(_._2.size).sum + extraSalt | |
def main(args:Array[String]):Unit = { | |
val random = new Random(seed) | |
val i = random.nextInt(participants.size) | |
System.out.println(s"$i:${participants(i)}") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment