Click here to Skip to main content
15,902,198 members
Home / Discussions / C#
   

C#

 
GeneralRe: BackgroundWorker completes immediately Pin
#realJSOP26-Jul-08 10:26
professional#realJSOP26-Jul-08 10:26 
GeneralRe: BackgroundWorker completes immediately Pin
Mark Salsbery26-Jul-08 10:43
Mark Salsbery26-Jul-08 10:43 
QuestionRe: BackgroundWorker completes immediately Pin
Mark Salsbery26-Jul-08 10:47
Mark Salsbery26-Jul-08 10:47 
AnswerRe: BackgroundWorker completes immediately Pin
Luc Pattyn26-Jul-08 7:31
sitebuilderLuc Pattyn26-Jul-08 7:31 
AnswerRe: BackgroundWorker completes immediately Pin
Ed.Poore26-Jul-08 9:23
Ed.Poore26-Jul-08 9:23 
GeneralRe: BackgroundWorker completes immediately Pin
#realJSOP26-Jul-08 10:16
professional#realJSOP26-Jul-08 10:16 
AnswerRe: BackgroundWorker completes immediately [SOLVED] Pin
#realJSOP26-Jul-08 11:20
professional#realJSOP26-Jul-08 11:20 
GeneralRe: BackgroundWorker completes immediately [SOLVED] Pin
Ed.Poore26-Jul-08 11:21
Ed.Poore26-Jul-08 11:21 
QuestionBackColor Pin
Evan St. John26-Jul-08 5:50
Evan St. John26-Jul-08 5:50 
AnswerRe: BackColor Pin
Evan St. John26-Jul-08 6:04
Evan St. John26-Jul-08 6:04 
AnswerRe: BackColor Pin
PIEBALDconsult26-Jul-08 8:29
mvePIEBALDconsult26-Jul-08 8:29 
GeneralRe: BackColor Pin
Evan St. John26-Jul-08 14:08
Evan St. John26-Jul-08 14:08 
GeneralRe: BackColor Pin
PIEBALDconsult26-Jul-08 18:12
mvePIEBALDconsult26-Jul-08 18:12 
GeneralRe: BackColor Pin
Evan St. John26-Jul-08 23:59
Evan St. John26-Jul-08 23:59 
QuestionCannot evaluate expression because a native frame is on top of the call stack [modified] Pin
enginço26-Jul-08 4:47
enginço26-Jul-08 4:47 
AnswerRe: Cannot evaluate expression because a native frame is on top of the call stack Pin
Guffa26-Jul-08 7:25
Guffa26-Jul-08 7:25 
GeneralRe: Cannot evaluate expression because a native frame is on top of the call stack Pin
enginço27-Jul-08 6:24
enginço27-Jul-08 6:24 
QuestionRandom Name List Pin
C#Coudou26-Jul-08 3:49
C#Coudou26-Jul-08 3:49 
AnswerRe: Random Name List Pin
PIEBALDconsult26-Jul-08 4:22
mvePIEBALDconsult26-Jul-08 4:22 
AnswerRe: Random Name List Pin
Yosh_26-Jul-08 4:23
professionalYosh_26-Jul-08 4:23 
GeneralRe: Random Name List Pin
PIEBALDconsult26-Jul-08 7:50
mvePIEBALDconsult26-Jul-08 7:50 
AnswerRe: Random Name List Pin
Guffa26-Jul-08 14:31
Guffa26-Jul-08 14:31 
Put the available names in an array, then this method will pick the specified number of strings from it:
private string[] PickFrom(string[] values, int count) {
	Random r = new Random();
	string[] result = new string[count];
	for (int i = 0, index = 0; index < count; i++) {
		if (r.Next(values.Length - i) < count - index) {
			result[index++] = values[i];
		}
	}
	return result;
}

Usage:

string[] group = PickFrom(listOfNames, 50);

Note: The names in the returned array will be in the same order relative to each other as in the original array. If the original array is sorted, the resulting array will also be.

Despite everything, the person most likely to be fooling you next is yourself.

GeneralRe: Random Name List Pin
Luc Pattyn26-Jul-08 15:53
sitebuilderLuc Pattyn26-Jul-08 15:53 
GeneralRe: Random Name List Pin
Guffa26-Jul-08 17:02
Guffa26-Jul-08 17:02 
GeneralRe: Random Name List Pin
Luc Pattyn26-Jul-08 17:41
sitebuilderLuc Pattyn26-Jul-08 17:41 

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.