diff --git a/src/engine/adapter.js b/src/engine/adapter.js
index 8a6a7fafd..9d17f92b8 100644
--- a/src/engine/adapter.js
+++ b/src/engine/adapter.js
@@ -1,32 +1,6 @@
 const mutationAdapter = require('./mutation-adapter');
 const html = require('htmlparser2');
-
-/**
- * (Copied from Blockly.utils)
- * Legal characters for the unique ID.  Should be all on a US keyboard.
- * No characters that conflict with XML or JSON.  Requests to remove additional
- * 'problematic' characters from this soup will be denied.  That's your failure
- * to properly escape in your own environment.  Issues #251, #625, #682, #1304.
- * @private
- */
-const genUidSoup_ = '!#$%()*+,-./:;=?@[]^_`{|}~' +
-    'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
-
-/**
- * (Copied from Blockly.utils)
- * Generate a unique ID.  This should be globally unique.
- * 87 characters ^ 20 length > 128 bits (better than a UUID).
- * @return {string} A globally unique ID string.
- */
-const genUid_ = function () {
-    const length = 20;
-    const soupLength = genUidSoup_.length;
-    const id = [];
-    for (let i = 0; i < length; i++) {
-        id[i] = genUidSoup_.charAt(Math.random() * soupLength);
-    }
-    return id.join('');
-};
+const uid = require('../util/uid');
 
 /**
  * Convert and an individual block DOM to the representation tree.
@@ -39,7 +13,7 @@ const genUid_ = function () {
  */
 const domToBlock = function (blockDOM, blocks, isTopBlock, parent) {
     if (!blockDOM.attribs.id) {
-        blockDOM.attribs.id = genUid_();
+        blockDOM.attribs.id = uid();
     }
 
     // Block skeleton.