From 639a559dd44d924c6b2e545c7d2eb28b11d4a314 Mon Sep 17 00:00:00 2001 From: sanine Date: Sun, 5 Nov 2023 22:35:03 -0600 Subject: begin implementing agent proposals --- src/util.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/util.js') diff --git a/src/util.js b/src/util.js index 4e23d9d..8b85ba7 100644 --- a/src/util.js +++ b/src/util.js @@ -14,3 +14,10 @@ export function random_choice(collection, r) { const idx = Math.floor(collection.length * r); return collection[idx]; } + + +export function pairs(arr1, arr2) { + return arr1 + .map((x, i) => arr2.map(y => [x, y])) + .flat(); +} -- cgit v1.2.1