Sorting algorithms/Bogosort: Difference between revisions
Content added Content deleted
Walterpachl (talk | contribs) (→{{header|PL/I}}: don't swap an element with itself (improvement taken from REXX)) |
m (→modified bogo sort: uploaded modified bogo sort with the updated version.) |
||
Line 1,846: | Line 1,846: | ||
if @.k>=? then iterate /*is this # in order? Get next. */ |
if @.k>=? then iterate /*is this # in order? Get next. */ |
||
/*get 2 unique random #s for swap*/ |
/*get 2 unique random #s for swap*/ |
||
do until a\==b; a=random( |
do until a\==b; a=random(j, k); b=random(j, k); end |
||
parse value @.a @.b with @.b @.a /*swap 2 random #s in array.*/ |
parse value @.a @.b with @.b @.a /*swap 2 random #s in array.*/ |