Skip to content

Commit

Permalink
fix(snippet): seed padding and wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
vhf committed May 27, 2024
1 parent 649edc4 commit a749b56
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/snippet.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ window.$o = {
isCapture: query.has('capture'),
registerExport,
registerFeatures,
seed: Math.floor(Math.random() * Date.now()),
seed: Math.floor(Math.random() * Date.now()) % 4294967296,
};
if (query.has('seed')) {
$o.seed =
parseInt(
query
.get('seed')
.replace(/[^0-9a-f]/gi, 'f')
.padEnd(8, 'f'),
.padStart(8, '0'),
16
) % Number.MAX_SAFE_INTEGER;
) % 4294967296;
query.set('seed', $o.seed.toString(16));
window.history.pushState('', '', '?' + query.toString());
}
Expand Down

0 comments on commit a749b56

Please sign in to comment.