Click here to Skip to main content
14,603,993 members
   

C#

 
AnswerRe: Cannot evaluate expression because a native frame is on top of the call stack Pin
Guffa26-Jul-08 7:25
MemberGuffa26-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
Memberenginço27-Jul-08 6:24 
QuestionRandom Name List Pin
C#Coudou26-Jul-08 3:49
MemberC#Coudou26-Jul-08 3:49 
AnswerRe: Random Name List Pin
PIEBALDconsult26-Jul-08 4:22
professionalPIEBALDconsult26-Jul-08 4:22 
AnswerRe: Random Name List Pin
Creamboy26-Jul-08 4:23
MemberCreamboy26-Jul-08 4:23 
GeneralRe: Random Name List Pin
PIEBALDconsult26-Jul-08 7:50
professionalPIEBALDconsult26-Jul-08 7:50 
AnswerRe: Random Name List Pin
Guffa26-Jul-08 14:31
MemberGuffa26-Jul-08 14:31 
GeneralRe: Random Name List Pin
Luc Pattyn26-Jul-08 15:53
sitebuilderLuc Pattyn26-Jul-08 15:53 
Hi Guffa,

I like that approach very much.
I was puzzled though by the details of the conditional test.

Shouldn't all candidate values get the same probability?
IMO the test should read if ( r.Next(values.Length) < count )
so each value[i] has probability count/value.Length

[ADDED] I see now. With fair probabilities, the algo may fail altogether,
when r decides to return lots of large numbers. So you are cheating a bit
to make it work all the time, at the expense of the first elements in the array,
since your probabilities are increasing at first.

Very clever. A little explanation was in order though.
[/ADDED]

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

Voting for dummies? No thanks. Dead | X|


GeneralRe: Random Name List Pin
Guffa26-Jul-08 17:02
MemberGuffa26-Jul-08 17:02 
GeneralRe: Random Name List Pin
Luc Pattyn26-Jul-08 17:41
sitebuilderLuc Pattyn26-Jul-08 17:41 
GeneralRe: Random Name List Pin
PIEBALDconsult26-Jul-08 18:51
professionalPIEBALDconsult26-Jul-08 18:51 
QuestionRemote Desktop Sharing Pin
Chetan Patel26-Jul-08 2:32
MemberChetan Patel26-Jul-08 2:32 
AnswerRe: Remote Desktop Sharing Pin
Ed.Poore26-Jul-08 2:49
MemberEd.Poore26-Jul-08 2:49 
QuestionTypesafe collection that accepts two items Pin
Gareth H26-Jul-08 2:03
MemberGareth H26-Jul-08 2:03 
AnswerRe: Typesafe collection that accepts two items Pin
Luc Pattyn26-Jul-08 2:35
sitebuilderLuc Pattyn26-Jul-08 2:35 
AnswerRe: Typesafe collection that accepts two items Pin
Kevin McFarlane26-Jul-08 2:42
MemberKevin McFarlane26-Jul-08 2:42 
AnswerRe: Typesafe collection that accepts two items Pin
Ed.Poore26-Jul-08 2:55
MemberEd.Poore26-Jul-08 2:55 
GeneralRe: Typesafe collection that accepts two items Pin
Gareth H26-Jul-08 3:16
MemberGareth H26-Jul-08 3:16 
Questionwebservice on another system Pin
balu1234526-Jul-08 0:39
Memberbalu1234526-Jul-08 0:39 
AnswerRe: webservice on another system [modified] Pin
Ed.Poore26-Jul-08 2:46
MemberEd.Poore26-Jul-08 2:46 
QuestionSplitting a Byte Array Pin
vayanan25-Jul-08 23:02
Membervayanan25-Jul-08 23:02 
AnswerRe: Splitting a Byte Array Pin
DaveyM6925-Jul-08 23:10
professionalDaveyM6925-Jul-08 23:10 
GeneralRe: Splitting a Byte Array Pin
vayanan26-Jul-08 1:22
Membervayanan26-Jul-08 1:22 
Questionwebservice problem Pin
balu1234525-Jul-08 22:37
Memberbalu1234525-Jul-08 22:37 
AnswerRe: webservice problem Pin
Ed.Poore25-Jul-08 22:51
MemberEd.Poore25-Jul-08 22:51 

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.