Click here to Skip to main content
15,920,956 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: On list.OrderBy(x => random.Next()) Pin
harold aptroot24-Oct-17 4:12
harold aptroot24-Oct-17 4:12 
GeneralRe: On list.OrderBy(x => random.Next()) Pin
CodeWraith24-Oct-17 4:37
CodeWraith24-Oct-17 4:37 
GeneralRe: On list.OrderBy(x => random.Next()) Pin
lopatir24-Oct-17 4:44
lopatir24-Oct-17 4:44 
GeneralRe: On list.OrderBy(x => random.Next()) Pin
CodeWraith24-Oct-17 5:13
CodeWraith24-Oct-17 5:13 
GeneralRe: On list.OrderBy(x => random.Next()) Pin
Richard Andrew x6424-Oct-17 9:20
professionalRichard Andrew x6424-Oct-17 9:20 
GeneralRe: On list.OrderBy(x => random.Next()) Pin
Richard Deeming24-Oct-17 4:05
mveRichard Deeming24-Oct-17 4:05 
GeneralRe: On list.OrderBy(x => random.Next()) Pin
harold aptroot24-Oct-17 4:10
harold aptroot24-Oct-17 4:10 
GeneralRe: On list.OrderBy(x => random.Next()) Pin
megaadam24-Oct-17 4:20
professionalmegaadam24-Oct-17 4:20 
Nice! I was quite young when given this problem. (It is true: I was quite young in 1980). The language was Fortran and the container was an array of integers. So I solved by looping over all indexes and unconditionally swapping current index with random index. As far as I can tell this (accidentally) does not have the same flaw as your example. (AB happens after zero and two swaps, BA happens after either one of the possible swaps).

But what I am really after is: for this operation would I be wrong if I said that an indexable array, with my teenage algo, would give better performance than a linked list with the above code?
... such stuff as dreams are made on

GeneralRe: On list.OrderBy(x => random.Next()) Pin
BillWoodruff24-Oct-17 4:20
professionalBillWoodruff24-Oct-17 4:20 
GeneralRe: On list.OrderBy(x => random.Next()) Pin
harold aptroot24-Oct-17 5:10
harold aptroot24-Oct-17 5:10 
GeneralRe: On list.OrderBy(x => random.Next()) Pin
BillWoodruff24-Oct-17 22:03
professionalBillWoodruff24-Oct-17 22:03 
GeneralRe: On list.OrderBy(x => random.Next()) Pin
harold aptroot25-Oct-17 1:10
harold aptroot25-Oct-17 1:10 
GeneralRe: On list.OrderBy(x => random.Next()) Pin
BillWoodruff25-Oct-17 2:44
professionalBillWoodruff25-Oct-17 2:44 
GeneralRe: On list.OrderBy(x => random.Next()) Pin
harold aptroot25-Oct-17 5:21
harold aptroot25-Oct-17 5:21 
GeneralRe: On list.OrderBy(x => random.Next()) Pin
BillWoodruff25-Oct-17 6:56
professionalBillWoodruff25-Oct-17 6:56 
GeneralRe: On list.OrderBy(x => random.Next()) Pin
harold aptroot25-Oct-17 7:08
harold aptroot25-Oct-17 7:08 
GeneralRe: On list.OrderBy(x => random.Next()) Pin
Dan Neely25-Oct-17 3:38
Dan Neely25-Oct-17 3:38 
GeneralRe: On list.OrderBy(x => random.Next()) Pin
BillWoodruff25-Oct-17 3:44
professionalBillWoodruff25-Oct-17 3:44 
GeneralRe: On list.OrderBy(x => random.Next()) Pin
Dan Neely25-Oct-17 5:05
Dan Neely25-Oct-17 5:05 
GeneralRe: On list.OrderBy(x => random.Next()) Pin
BillWoodruff25-Oct-17 6:41
professionalBillWoodruff25-Oct-17 6:41 
GeneralRe: On list.OrderBy(x => random.Next()) Pin
Dan Neely25-Oct-17 7:37
Dan Neely25-Oct-17 7:37 
GeneralRe: On list.OrderBy(x => random.Next()) Pin
harold aptroot25-Oct-17 5:09
harold aptroot25-Oct-17 5:09 
GeneralCopy-Paste Coding Culture Pin
Jacquers24-Oct-17 2:07
Jacquers24-Oct-17 2:07 
AnswerRe: Copy-Paste Coding Culture Pin
W Balboos, GHB24-Oct-17 2:11
W Balboos, GHB24-Oct-17 2:11 
GeneralCopy-Paste Everything! Pin
megaadam24-Oct-17 2:54
professionalmegaadam24-Oct-17 2:54 

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.