Skip to content

Commit 1afa3d2

Browse files
Adding tiny bit of randomness to user input for the MSD radix sort to work properly
1 parent 3ea546a commit 1afa3d2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function saveValue(x1, y1, x2) {
5555
}
5656
let value = y1 / height;
5757
for (; index1 <= index2; index1++) {
58-
arrayToSort[index1] = value;
58+
arrayToSort[index1] = Math.min(1,value+Math.random()/500);
5959
}
6060
draw()
6161
if (sortIndex != null) {

0 commit comments

Comments
 (0)