Click here to Skip to main content
15,167,809 members
Home / Discussions / C#
   

C#

 
GeneralRe: Random Permutation Interface Pin
Pete O'Hanlon12-Sep-12 2:27
mvaPete O'Hanlon12-Sep-12 2:27 
GeneralRe: Random Permutation Interface Pin
Skippums12-Sep-12 7:41
MemberSkippums12-Sep-12 7:41 
AnswerRe: Random Permutation Interface Pin
PIEBALDconsult12-Sep-12 4:07
professionalPIEBALDconsult12-Sep-12 4:07 
AnswerRe: Random Permutation Interface Pin
Skippums12-Sep-12 8:32
MemberSkippums12-Sep-12 8:32 
GeneralRe: Random Permutation Interface Pin
BillWoodruff13-Sep-12 3:37
mveBillWoodruff13-Sep-12 3:37 
GeneralRe: Random Permutation Interface Pin
PIEBALDconsult13-Sep-12 4:23
professionalPIEBALDconsult13-Sep-12 4:23 
GeneralRe: Random Permutation Interface Pin
PIEBALDconsult13-Sep-12 4:27
professionalPIEBALDconsult13-Sep-12 4:27 
GeneralRe: Random Permutation Interface Pin
Skippums13-Sep-12 8:27
MemberSkippums13-Sep-12 8:27 
Actually, I did end up making my method that returns a T[] public, and deleted all the wrapper methods. I figured that if clients want the result in a stack, queue, list, etc., they can build it themselves with a simple constructor call. Plus, having an extension method on IEnumerable allows a client to get a permutation from a set, which seems like it could be a useful operation.


PIEBALDconsult wrote:
something like a RandomSequence(int n) that returns an array of 0..n in random order


Actually, in the code I posted, a client can get this with a call to long[] Permutation.Random(long size). I suppose I could add the same code for int, but don't really see the point. I also thought about allowing a client to get a specific permutation, but that only works for permutations up to length 20 (since 21! > 264), unless I include a large integer library.
Sounds like somebody's got a case of the Mondays

-Jeff

Questionconvert xdocument to integer Pin
rachel_m11-Sep-12 13:16
Memberrachel_m11-Sep-12 13:16 
AnswerRe: convert xdocument to integer Pin
Pete O'Hanlon11-Sep-12 13:22
mvaPete O'Hanlon11-Sep-12 13:22 
GeneralRe: convert xdocument to integer Pin
rachel_m11-Sep-12 17:04
Memberrachel_m11-Sep-12 17:04 
GeneralRe: convert xdocument to integer Pin
Eddy Vluggen11-Sep-12 21:55
professionalEddy Vluggen11-Sep-12 21:55 
GeneralRe: convert xdocument to integer Pin
rachel_m12-Sep-12 5:44
Memberrachel_m12-Sep-12 5:44 
GeneralRe: convert xdocument to integer Pin
PIEBALDconsult13-Sep-12 4:29
professionalPIEBALDconsult13-Sep-12 4:29 
GeneralRe: convert xdocument to integer Pin
Pete O'Hanlon11-Sep-12 23:16
mvaPete O'Hanlon11-Sep-12 23:16 
QuestionCOM+ Event System Pin
Member 813710511-Sep-12 12:40
MemberMember 813710511-Sep-12 12:40 
AnswerRe: COM+ Event System Pin
Bernhard Hiller11-Sep-12 21:24
MemberBernhard Hiller11-Sep-12 21:24 
Question.Net Validation Pin
rmorton11-Sep-12 9:45
Memberrmorton11-Sep-12 9:45 
Answeroracle exception Pin
yaswanth00111-Sep-12 8:19
Memberyaswanth00111-Sep-12 8:19 
AnswerRe: oracle exception Pin
Andrei Straut11-Sep-12 8:28
MemberAndrei Straut11-Sep-12 8:28 
AnswerRe: oracle exception Pin
Abhinav S11-Sep-12 8:56
MemberAbhinav S11-Sep-12 8:56 
GeneralRe: oracle exception Pin
Pete O'Hanlon11-Sep-12 8:58
mvaPete O'Hanlon11-Sep-12 8:58 
QuestionError Logging Pin
CodingYoshi11-Sep-12 4:26
MemberCodingYoshi11-Sep-12 4:26 
AnswerRe: Error Logging Pin
Pete O'Hanlon11-Sep-12 4:47
mvaPete O'Hanlon11-Sep-12 4:47 
GeneralRe: Error Logging Pin
CodingYoshi11-Sep-12 4:53
MemberCodingYoshi11-Sep-12 4:53 

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.