mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-25 23:29:58 -07:00
bitview: reorg part 2
This commit is contained in:
20
websites/bitview/scripts/core/array.js
Normal file
20
websites/bitview/scripts/core/array.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* @param {number} start
|
||||
* @param {number} end
|
||||
*/
|
||||
export function range(start, end) {
|
||||
const range = [];
|
||||
while (start <= end) {
|
||||
range.push(start);
|
||||
start += 1;
|
||||
}
|
||||
return range;
|
||||
}
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @param {T[]} array
|
||||
*/
|
||||
export function random(array) {
|
||||
return array[Math.floor(Math.random() * array.length)];
|
||||
}
|
||||
Reference in New Issue
Block a user