1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-26 07:55:16 +02:00
This commit is contained in:
Justin Lin
2021-03-07 09:42:54 +08:00
parent 78a53df419
commit 0f1687327d
5 changed files with 62 additions and 3 deletions

16
docs/lib3x-find_index.md Normal file
View File

@@ -0,0 +1,16 @@
# find_index
Returns the index of the first element in the list that satisfies the testing function. If no element passed the test, it returns -1.
**Since:** 3.0
## Parameters
- `lt` : The list.
- `test` : the testing function.
## Examples
use <util/find_index.scad>;
assert(find_index([10, 20, 30, 40], function(e) e > 10) == 1);

16
docs/lib3x-shuffle.md Normal file
View File

@@ -0,0 +1,16 @@
# shuffle
Randomizes the order of the elements of a list.
**Since:** 3.0
## Parameters
- `lt` : The list to shuffle.
- `seed` : Random seed value.
## Examples
use <util/shuffle.scad>;
echo(shuffle([1, 2, 3, 4]));

17
docs/lib3x-swap.md Normal file
View File

@@ -0,0 +1,17 @@
# swap
Swaps two elements in a list.
**Since:** 3.0
## Parameters
- `lt` : The list.
- `i` : The index of an element.
- `j` : The index of the other element
## Examples
use <util/swap.scad>;
assert(swap([10, 20, 30, 40], 1, 3) == [10, 40, 30, 20]);