diff --git a/web/utils/text-utils.js b/web/utils/text-utils.js
--- a/web/utils/text-utils.js
+++ b/web/utils/text-utils.js
@@ -1,10 +1,14 @@
 // @flow
 
-import crypto from 'crypto';
 import invariant from 'invariant';
 
 let canvas;
 
+declare var crypto: {
+  getRandomValues<NumArray: $TypedArray>(typedArray: NumArray): NumArray,
+  ...
+};
+
 function calculateMaxTextWidth(
   texts: $ReadOnlyArray<string>,
   font: string,
@@ -46,7 +50,8 @@
   let str = '';
 
   while (str.length < length) {
-    const rand = crypto.randomBytes(drawBytes);
+    const rand = new Uint8Array(drawBytes);
+    crypto.getRandomValues(rand);
 
     for (let i = 0; str.length < length && i < drawBytes; i++) {
       if (rand[i] < validByteUpperBound) {