ShuffleStrings uses a seeded rand object

This commit is contained in:
Abhishek Shah
2015-09-09 12:08:57 -07:00
parent 891cef4efa
commit da06ecfc1f
3 changed files with 25 additions and 2 deletions

View File

@@ -18,7 +18,7 @@ limitations under the License.
package slice
import (
"math/rand"
utilrand "k8s.io/kubernetes/pkg/util/rand"
"sort"
)
@@ -41,7 +41,7 @@ func SortStrings(s []string) []string {
// order. It returns a new slice.
func ShuffleStrings(s []string) []string {
shuffled := make([]string, len(s))
perm := rand.Perm(len(s))
perm := utilrand.Perm(len(s))
for i, j := range perm {
shuffled[j] = s[i]
}