Click here to Skip to main content
15,905,508 members
Home / Discussions / C#
   

C#

 
GeneralRe: 4 different random numbers Pin
insurgentpyro6-Jul-04 18:50
insurgentpyro6-Jul-04 18:50 
GeneralRe: 4 different random numbers Pin
Christian Graus7-Jul-04 12:22
protectorChristian Graus7-Jul-04 12:22 
GeneralRe: 4 different random numbers Pin
Anonymous7-Jul-04 17:51
Anonymous7-Jul-04 17:51 
GeneralRe: 4 different random numbers Pin
Arjan Einbu6-Jul-04 12:29
Arjan Einbu6-Jul-04 12:29 
GeneralRe: 4 different random numbers Pin
insurgentpyro6-Jul-04 18:52
insurgentpyro6-Jul-04 18:52 
GeneralRe: 4 different random numbers Pin
Arjan Einbu7-Jul-04 1:34
Arjan Einbu7-Jul-04 1:34 
GeneralRe: 4 different random numbers Pin
Anonymous7-Jul-04 5:39
Anonymous7-Jul-04 5:39 
GeneralRe: 4 different random numbers Pin
Arjan Einbu7-Jul-04 10:27
Arjan Einbu7-Jul-04 10:27 
The algorithm will in some cases fail, if the numbers aren't sorted lowest to highest.

Example: If you allready picked 5 and 4 (in that order) and now you're picking 4 again. First check finds that 4 (latest pick) is less than 5 (first pick), so latest pick isn't increased.
The second check will compare 4 (from the latest pick) with 4 (from the second pick) and decide it should increase the latest pick. The latest pick is now 5, and card number 5 can't be picked twice.

When the numbers are sorted, the last pick will increase to 5 on the first comparison and to 6 on the second. Now no cards are beeing picked twice.


Have a look at my latest article about Object Prevalence with Bamboo Prevalence.
GeneralRe: 4 different random numbers Pin
mikeschuld6-Jul-04 13:18
mikeschuld6-Jul-04 13:18 
GeneralRe: 4 different random numbers Pin
insurgentpyro6-Jul-04 18:50
insurgentpyro6-Jul-04 18:50 
GeneralRe: 4 different random numbers Pin
mikeschuld7-Jul-04 21:52
mikeschuld7-Jul-04 21:52 
QuestionC++ Objects in C#? Pin
So and So6-Jul-04 8:16
So and So6-Jul-04 8:16 
AnswerRe: C++ Objects in C#? Pin
Dave Kreskowiak6-Jul-04 8:31
mveDave Kreskowiak6-Jul-04 8:31 
AnswerRe: C++ Objects in C#? Pin
Heath Stewart6-Jul-04 10:03
protectorHeath Stewart6-Jul-04 10:03 
GeneralRe: C++ Objects in C#? Pin
leppie6-Jul-04 10:48
leppie6-Jul-04 10:48 
GeneralRe: C++ Objects in C#? Pin
Heath Stewart6-Jul-04 10:53
protectorHeath Stewart6-Jul-04 10:53 
GeneralRe: C++ Objects in C#? Pin
MKlucher6-Jul-04 11:22
MKlucher6-Jul-04 11:22 
GeneralRe: C++ Objects in C#? Pin
Heath Stewart6-Jul-04 12:20
protectorHeath Stewart6-Jul-04 12:20 
GeneralRe: C++ Objects in C#? Pin
MKlucher6-Jul-04 13:13
MKlucher6-Jul-04 13:13 
GeneralRe: C++ Objects in C#? Pin
Stefan Troschuetz6-Jul-04 21:16
Stefan Troschuetz6-Jul-04 21:16 
GeneralRe: C++ Objects in C#? Pin
Heath Stewart7-Jul-04 2:54
protectorHeath Stewart7-Jul-04 2:54 
GeneralVolume Controls and interop Pin
Oldmate6-Jul-04 4:38
Oldmate6-Jul-04 4:38 
GeneralRe: Volume Controls and interop Pin
Heath Stewart6-Jul-04 5:10
protectorHeath Stewart6-Jul-04 5:10 
GeneralRe: Volume Controls and interop Pin
Oldmate6-Jul-04 15:55
Oldmate6-Jul-04 15:55 
GeneralRe: Volume Controls and interop Pin
Heath Stewart7-Jul-04 3:04
protectorHeath Stewart7-Jul-04 3:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.