1
0
mirror of https://github.com/golang/go synced 2024-11-23 00:10:07 -07:00

perm is [] instead of map

R=r
OCL=19569
CL=19569
This commit is contained in:
Ken Thompson 2008-11-18 19:59:56 -08:00
parent b2b4e7fa55
commit 497e648e7e

View File

@ -14,7 +14,7 @@ package rand
// urand32 - return random uint32 // urand32 - return random uint32
// nrand, nrand31, nrand63 - return 0 <= random < n // nrand, nrand31, nrand63 - return 0 <= random < n
// frand, frand64, frand32 - return 0 <= random float, float64, float32 < 1 // frand, frand64, frand32 - return 0 <= random float, float64, float32 < 1
// perm gives a random permutation map[int]int // perm gives a random permutation []int
const const
( (
@ -164,9 +164,9 @@ frand() float
} }
export func export func
perm(n int) *map[int]int perm(n int) *[]int
{ {
m := new(map[int]int); m := new([]int, n);
for i:=0; i<n; i++ { for i:=0; i<n; i++ {
m[i] = i; m[i] = i;
} }