Skip to content

Commit c617a13

Browse files
committed
add todo
1 parent 26d2b14 commit c617a13

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

fisher_yates_knuth_shuffle.go

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ func FisherYatesKnuthShuffle[T any](slice []T) {
1818

1919
// FisherYatesShuffleMatrix Fisher–Yates-Knuth shuffle算法对矩阵洗牌
2020
func FisherYatesShuffleMatrix[T any](matrix [][]T) {
21+
// TODO 检查参数是否符合矩阵
22+
// TODO 提高性能
2123
row, col := len(matrix), len(matrix[0])
2224
for index := row*col - 1; index > 0; index-- {
2325
chooseIndex := standaloneRand.Intn(index + 1)

sattolo.go

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ func SattoloShuffle[T any](slice []T) {
1111
func SattoloShuffleMatrix[T any](matrix [][]T) {
1212
row, col := len(matrix), len(matrix[0])
1313
for index := row*col - 1; index > 0; index-- {
14+
// TODO 检查参数是否符合矩阵
15+
// TODO 提高性能
1416
chooseIndex := standaloneRand.Intn(index)
1517
matrix[index/col][index%col], matrix[chooseIndex/col][chooseIndex%col] = matrix[chooseIndex/col][chooseIndex%col], matrix[index/col][index%col]
1618
}

0 commit comments

Comments
 (0)