Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple paths is not random #342

Open
tulequ opened this issue Jun 3, 2023 · 4 comments
Open

multiple paths is not random #342

tulequ opened this issue Jun 3, 2023 · 4 comments

Comments

@tulequ
Copy link

tulequ commented Jun 3, 2023

I have the problem that paths is not random
When I check source, I see below
It wasn't at all? Is anything I am missing?

// if no particular path was requested, choose a random one
path := ""
for path = range paths {
break
}

@tulequ
Copy link
Author

tulequ commented Jun 5, 2023

I have a small test

package main

import (
	"fmt"
)

func main() {
	paths := map[string]int{"a": 0, "b": 0, "c": 0}

	for i := 0; i < 10000; i++ {
		for p := range paths {
			paths[p]++
			break
		}
	}

	fmt.Println(paths)
}

Result is random but is not even, so it is unusable

# go run .
map[a:7480 b:1287 c:1233]

tulequ pushed a commit to tulequ/local-path-provisioner that referenced this issue Jun 18, 2023
Copy link

github-actions bot commented Jun 6, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the stale label Jun 6, 2024
Copy link

This issue was closed because it has been stalled for 5 days with no activity.

@adrecord
Copy link

This is still a problem, and the distribution of chosen paths is very uneven, as @tulequ noted. @tulequ, were you going to create a PR so hopefully this gets fixed in main?

@derekbit derekbit reopened this Feb 20, 2025
@github-actions github-actions bot removed the stale label Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants