dotnet / dotnet/dotnet-api-docs

Need to explicitly state GetItems is non-unique

Open
#10,070 3 comments 0 reactions 0 assignees View on GitHub
area-WinForms Pri3 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

When coding I was surprised to find duplicates were returned by GetItems. Yes, it's in the Random folder. However, when prizes are drawn for people, prizes are selected randomly, but usually once a person wins, that ticket is discarded and not part of the next round of drawings. This function acts more like when a die is rolled. That is fine, but not blatantly obvious.

Please change the description to something more like, "The method uses Next(Int32) to select items randomly from choices by index. The selection is a non-unique selection. This is used to populate a newly-created array."

Anything like this that makes it obvious is appreciated. Then I would have never attempted to use this function, because I would have known it didn't meet my needs. (Talking the programmers into having a byte that specifies a unique or non-unique selection that is returned would be even more useful and obvious. However, as a busy programmer, I know there is about 0% chance of that happening, even if it would be incredibly useful.)

Thanks for all you do and for putting up with us programmers and our egos.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.