diff options
| author | Josh Bleecher Snyder <josharian@gmail.com> | 2017-07-25 17:53:30 -0700 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2017-09-08 13:03:02 +0000 |
| commit | a2dfe5d278eae0864397a046a8206342a426d2bd (patch) | |
| tree | a8020e62a551f27ccdba084a667a19c5ac48de0d /src/database/sql | |
| parent | 32e117d971eb4f802f27b98a0f13b7d9fc2d73fb (diff) | |
| download | go-a2dfe5d278eae0864397a046a8206342a426d2bd.tar.xz | |
math/rand: add Shuffle
Shuffle uses the Fisher-Yates algorithm.
Since this is new API, it affords us the opportunity
to use a much faster Int31n implementation that mostly avoids division.
As a result, BenchmarkPerm30ViaShuffle is
about 30% faster than BenchmarkPerm30,
despite requiring a separate initialization loop
and using function calls to swap elements.
Fixes #20480
Updates #16213
Updates #21211
Change-Id: Ib8956c4bebed9d84f193eb98282ec16ee7c2b2d5
Reviewed-on: https://go-review.googlesource.com/51891
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/database/sql')
0 files changed, 0 insertions, 0 deletions
