Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.39 KB | None | 0 0
  1. import scala.util.Random
  2.  
  3. object foo extends App {
  4. val seed = 564745757658568567l
  5. val Random1 = new Random(seed)
  6. val Random2 = new Random(seed)
  7.  
  8. val input = List(1,2,3,4,5,6,7) // 54,43,65,76,87,98
  9. def shuffle(i:List[Int]):List[Int] = {
  10.   val rng = new Random(seed)
  11.   i.map(x => (x ^ rng.nextInt(999999)))
  12. }
  13.  
  14. val shuffled = shuffle(input)
  15. println(shuffled)
  16. println(shuffle(shuffled))
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement