dotnet / dotnet-api-docs

.NET API reference documentation (.NET 5+, .NET Core, .NET Framework)
https://docs.microsoft.com/dotnet/api/
Other
719 stars 1.56k forks source link

Need to explicitly state GetItems is non-unique #10070

Open amortensen13 opened 3 months ago

amortensen13 commented 3 months ago

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.

dotnet-issue-labeler[bot] commented 3 months ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

dotnet-issue-labeler[bot] commented 3 months ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

tarekgh commented 3 months ago

@amortensen13 could you please specify the exact class and namespace containing the GetItems method?