Sorting algorithms/Bogosort: Difference between revisions
Content added Content deleted
(Added Quackery) |
Alextretyak (talk | contribs) (Added 11l) |
||
Line 24: | Line 24: | ||
The [[Knuth shuffle]] may be used to implement the shuffle part of this algorithm. |
The [[Knuth shuffle]] may be used to implement the shuffle part of this algorithm. |
||
<br><br> |
<br><br> |
||
=={{header|11l}}== |
|||
<lang 11l>F is_sorted(data) |
|||
R all((0 .< data.len - 1).map(i -> @data[i] <= @data[i + 1])) |
|||
F bogosort(&data) |
|||
L !is_sorted(data) |
|||
random:shuffle(&data) |
|||
V arr = [2, 1, 3] |
|||
bogosort(&arr) |
|||
print(arr)</lang> |
|||
{{out}} |
|||
<pre> |
|||
[1, 2, 3] |
|||
</pre> |
|||
=={{header|AArch64 Assembly}}== |
=={{header|AArch64 Assembly}}== |
||
{{works with|as|Raspberry Pi 3B version Buster 64 bits}} |
{{works with|as|Raspberry Pi 3B version Buster 64 bits}} |
||
Line 201: | Line 218: | ||
.include "../includeARM64.inc" |
.include "../includeARM64.inc" |
||
</lang> |
</lang> |
||
=={{header|ActionScript}}== |
=={{header|ActionScript}}== |
||
<lang actionscript>public function bogoSort(arr:Array):Array |
<lang actionscript>public function bogoSort(arr:Array):Array |