From d868fea8650c05a72d83d7c00c39bcf528c9fdfe Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Mon, 15 Jul 2024 10:45:05 +0700 Subject: [PATCH] Create agi.utils.js --- models/agi/agi.utils.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 models/agi/agi.utils.js diff --git a/models/agi/agi.utils.js b/models/agi/agi.utils.js new file mode 100644 index 0000000..7e2b1b1 --- /dev/null +++ b/models/agi/agi.utils.js @@ -0,0 +1,7 @@ +export function randomize(arr) { + return arr[Math.floor(Math.random() * arr.length)]; +} + +export function normalize(arr) { + return arr.map(x => x / Math.max(...arr)); +}