+ 1
Filling an array with random numbers
I filled an array with random numbers but I can't figure out any way to make it so that each number comes out just once. Has anybody got a solution to do that with c# ?
11 ответов
+ 9
This code generates an array of 10 random numbers
i.e. 0 to 9 in any random order.
Let me know whether this is what you are looking at-
https://code.sololearn.com/cMCL8uNxF5l6/?ref=app
+ 6
@Tho5mas you're welcome! 😇
@luka you did the same thing of getting distinct numbers. Only difference, you are not printing it😅
+ 2
you can use
bool arrayName.Contains(value)
+ 2
Thanks a bunch! I'll try these.
+ 2
All my thanks to Apoorva and Luka. You helped me a lot. I can't believe I racked my brain and tried for hours to do that with conditions.
+ 1
@Gordie. Thanks a lot for your explanations, it's crystal clear and helped a great deal!
0
@Gordie. Fair enough, your answer shall then be the second best:)