Anonymous user
Sorting algorithms/Bogosort: Difference between revisions
m
→{{header|Eiffel}}
Line 465:
=={{header|Eiffel}}==
<lang Eiffel>
class
BOGO_SORT
Line 506 ⟶ 505:
end
-- Array containing the same elements as 'ar' in a
require
local
random: V_RANDOM
do
Line 518 ⟶ 516:
create Result.make_empty
Result.deep_copy (ar)
across
▲ i := ar.count
1 |..| count as c
loop
j := random.bounded_item (
ith := Result [
Result [
Result [j] := ith
random.forth
end
ensure
same_elements: across ar as a all Result.has (a.item) end
end
Line 544 ⟶ 542:
make
feature {NONE}
make
|