Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import scala.util.Random
- object foo extends App {
- val seed = 564745757658568567l
- val Random1 = new Random(seed)
- val Random2 = new Random(seed)
- val input = List(1,2,3,4,5,6,7) // 54,43,65,76,87,98
- def shuffle(i:List[Int]):List[Int] = {
- val rng = new Random(seed)
- i.map(x => (x ^ rng.nextInt(999999)))
- }
- val shuffled = shuffle(input)
- println(shuffled)
- println(shuffle(shuffled))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement