Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.
This repository was archived by the owner on Feb 18, 2025. It is now read-only.

question about random order in CheckAndRecover function #798

@yangeagle

Description

@yangeagle

File: go/logic/topology_recovery.go
Function: CheckAndRecover
Code:

... ...
	// intentionally iterating entries in random order
	for i := range rand.Perm(len(replicationAnalysis)) {
               analysisEntry := replicationAnalysis[i]

... ....

The iterating order is always 0, 1, 2, ...

I guess the code should be like as below:

        for i, j := range rand.Perm(10){
                fmt.Println("i:",i, ", j:", j)
        }

output:

i: 0 , j: 9
i: 1 , j: 4
i: 2 , j: 2
i: 3 , j: 6
i: 4 , j: 8
i: 5 , j: 0
i: 6 , j: 3
i: 7 , j: 1
i: 8 , j: 7
i: 9 , j: 5

The variable j should be used.

@MOON-CLJ

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions