refactor(project): Renamed all instances of dafa to msfa or mina-sidor-fa. (TV-379)
Squashed commit of the following: commit d3f52ff6876f6e246c7d3c188e56cc2370289341 Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se> Date: Tue Aug 17 14:10:38 2021 +0200 Renamed all dafa instances to msfa
This commit is contained in:
14
mock-api/mina-sidor-fa/scripts/utils/choose-random.util.js
Normal file
14
mock-api/mina-sidor-fa/scripts/utils/choose-random.util.js
Normal file
@@ -0,0 +1,14 @@
|
||||
function chooseRandom(arr, num = 1) {
|
||||
const res = [];
|
||||
for (let i = 0; i < num; ) {
|
||||
const random = Math.floor(Math.random() * arr.length);
|
||||
if (res.indexOf(arr[random]) !== -1) {
|
||||
continue;
|
||||
}
|
||||
res.push(arr[random]);
|
||||
i++;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
export default chooseRandom;
|
||||
Reference in New Issue
Block a user