mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-16 19:54:29 +02:00
refactor
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
use <../swap.scad>;
|
||||
|
||||
function _shuffle(lt, indices, leng, i = 0) =
|
||||
i == leng ? lt : _shuffle(swap(lt, i, indices[i]), indices, leng, i + 1);
|
||||
function _shuffle(lt, indices, leng) =
|
||||
let(end = len(lt) - 1)
|
||||
end == 0 ? lt :
|
||||
let(cum = [for(i = 0, s = swap(lt, i, indices[i]); i < end; i = i + 1, s = swap(s, i, indices[i])) s])
|
||||
swap(cum[len(cum) - 1], end, indices[end]);
|
Reference in New Issue
Block a user