Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
497e648e
Commit
497e648e
authored
Nov 18, 2008
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perm is [] instead of map
R=r OCL=19569 CL=19569
parent
b2b4e7fa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
src/lib/rand.go
src/lib/rand.go
+3
-3
No files found.
src/lib/rand.go
View file @
497e648e
...
@@ -14,7 +14,7 @@ package rand
...
@@ -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
...
@@ -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
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment