]> git.ardis.lu - minimal-masonry/commitdiff
Consolidate rng
authorArdis Lu <ardisglu@gmail.com>
Wed, 7 Jun 2023 05:51:02 +0000 (22:51 -0700)
committerArdis Lu <ardisglu@gmail.com>
Wed, 7 Jun 2023 05:51:02 +0000 (22:51 -0700)
index.html

index 43981576fb66535f80271497e319389ed584b53d..8708657286422843bd102d199ce95872fcd39188 100644 (file)
     const main = document.querySelector('main');
     main.insertAdjacentHTML('beforeend', '<div><h1></h1></div>'.repeat(20));
 
-    let rng = new Uint16Array(40); // 2 values used per object = 20 total objects
-    window.crypto.getRandomValues(rng);
-    rng = [...rng]; // Need to spread to a non-typed array to use .pop()
+    // Need to spread to a non-typed array to use .pop()
+    const rng = [...crypto.getRandomValues(new Uint16Array(40))]; // 2 values used per object = 20 total objects
 
     // All length units are px
     const gridRowHeight = 8;
This page took 0.034279 seconds and 4 git commands to generate.