v1
- by peerreynders 1/24/202300
Setup HTML - click to add setup HTML
disable setup JavaScript
Setup JavaScript
const format = new Intl.NumberFormat([], {
  minimumIntegerDigits: 10,
  useGrouping: false,
}).format;

const toValueIndexTuple = (value, index) => [value, index];
const byValueAsc = ([a], [b]) => a - b;

function shuffledKeys(entries) {
  const values = new Uint32Array(entries.length);
  crypto.getRandomValues(values);
  const pickKey = ([, index]) => entries[index][0];

  return Array.from(values, toValueIndexTuple).sort(byValueAsc).map(pickKey);
}

const toKeyEntry = (_value, index) => [
  'key' + format(SIZE - index - 1),
  format(index),
];

const SIZE = 10;
const ACCESS_PASSES = 1;
const entries = Array.from({ length: SIZE }, toKeyEntry);
const accessPattern = Array.from({ length: ACCESS_PASSES }, (_v) =>
  shuffledKeys(entries)
).flat();

const map = new Map(entries);
const objectMap = Object.fromEntries(entries);
delete caserun single casemove downdrag and drop case


ready



let total = Number.MIN_SAFE_INTEGER;
for (let i = 0; i < accessPattern.length; i += 1) {
  total += Number(objectMap[accessPattern[i]]);
}
delete caserun single casemove updrag and drop case


ready



let total = Number.MIN_SAFE_INTEGER;
for (let i = 0; i < accessPattern.length; i += 1) {
  total += Number(map.get(accessPattern[i]));
}
Test Case - click to add another test case
Teardown JS - click to add teardown JavaScript
Output (DOM) - click to monitor output (DOM) while test is running
RUN