Click here to Skip to main content
15,901,284 members
Home / Discussions / C#
   

C#

 
GeneralWeb request coding problem Pin
Niels Penneman22-Feb-04 0:14
Niels Penneman22-Feb-04 0:14 
Generalgetting common directory Pin
Rob Tomson21-Feb-04 23:56
Rob Tomson21-Feb-04 23:56 
GeneralGetting a unique system identifier Pin
mablebee21-Feb-04 22:18
mablebee21-Feb-04 22:18 
GeneralRe: Getting a unique system identifier Pin
Mazdak22-Feb-04 4:05
Mazdak22-Feb-04 4:05 
GeneralSelect Random Pin
Anonymous21-Feb-04 20:06
Anonymous21-Feb-04 20:06 
GeneralRe: Select Random Pin
Mazdak21-Feb-04 20:15
Mazdak21-Feb-04 20:15 
GeneralRe: Select Random Pin
Anonymous22-Feb-04 19:09
Anonymous22-Feb-04 19:09 
GeneralRe: Select Random Pin
turbochimp25-Feb-04 11:31
turbochimp25-Feb-04 11:31 
What I've done in the past is:

1. Add the objects (numbers in your example) to a collection, so that the collection count is 25 (items 0 through 24).
2. Create a loop to select n items from the collection.
3. On each iteration of the loop, select a random number from zero to collection.Count - 1
4. Retrieve the collection element at the selected index from the collection, then remove it from the collection. The next time the loop iterates, the previously selected item will no longer be selectable, it has been removed from the collection.

There are various optimizations over using a collection, depending on the type of item you're trying to select (reference type, character, integer etc), but the principle is valid, assuming that your original range contained no duplicates.

Hope this helps.
GeneralCustom Control Problem Pin
Guinness4Strength21-Feb-04 19:59
Guinness4Strength21-Feb-04 19:59 
GeneralRe: Custom Control Problem Pin
Dan_P21-Feb-04 22:02
Dan_P21-Feb-04 22:02 
GeneralRe: Custom Control Problem Pin
Guinness4Strength22-Feb-04 5:21
Guinness4Strength22-Feb-04 5:21 
GeneralSetting visibility of parent form from child. Pin
POnfri21-Feb-04 12:58
POnfri21-Feb-04 12:58 
GeneralRe: Setting visibility of parent form from child. Pin
POnfri21-Feb-04 15:09
POnfri21-Feb-04 15:09 
GeneralRe: Setting visibility of parent form from child. Pin
partyganger22-Feb-04 4:22
partyganger22-Feb-04 4:22 
Generaloverride vrs Event capturing Pin
Anonymous21-Feb-04 10:54
Anonymous21-Feb-04 10:54 
GeneralRe: override vrs Event capturing Pin
Charlie Williams21-Feb-04 11:18
Charlie Williams21-Feb-04 11:18 
GeneralRe: override vrs Event capturing Pin
Heath Stewart21-Feb-04 11:57
protectorHeath Stewart21-Feb-04 11:57 
QuestionHow to Delete a row using DeleteCommand of DataAdapter? Pin
gr8tushar21-Feb-04 9:10
gr8tushar21-Feb-04 9:10 
AnswerRe: How to Delete a row using DeleteCommand of DataAdapter? Pin
Charlie Williams21-Feb-04 11:01
Charlie Williams21-Feb-04 11:01 
GeneralDirectx SampleGrabberNET help Pin
russ.trow21-Feb-04 9:08
russ.trow21-Feb-04 9:08 
GeneralApplication Icons Pin
dbetting21-Feb-04 8:53
dbetting21-Feb-04 8:53 
Generalv small job for c# developer £50 Pin
notsosharp21-Feb-04 8:11
notsosharp21-Feb-04 8:11 
GeneralRe: v small job for c# developer £50 Pin
John Kuhn21-Feb-04 8:19
John Kuhn21-Feb-04 8:19 
GeneralRe: v small job for c# developer £50 Pin
Mazdak21-Feb-04 10:37
Mazdak21-Feb-04 10:37 
GeneralRe: v small job for c# developer £50 Pin
Kannan Kalyanaraman21-Feb-04 22:04
Kannan Kalyanaraman21-Feb-04 22: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.