github.com/prebid/prebid-server@v0.275.0/usersync/shuffler.go (about)

     1  package usersync
     2  
     3  import "math/rand"
     4  
     5  // shuffler changes the order of elements in the slice.
     6  type shuffler interface {
     7  	shuffle(v []string)
     8  }
     9  
    10  // randomShuffler randomly changes the order of elements in the slice.
    11  type randomShuffler struct{}
    12  
    13  func (randomShuffler) shuffle(v []string) {
    14  	rand.Shuffle(len(v), func(i, j int) { v[i], v[j] = v[j], v[i] })
    15  }