diff --git a/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php b/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php
index 97d7662..160baf4 100644
--- a/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php
+++ b/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php
@@ -59,7 +59,7 @@ protected function setUp() {
    * Tests an import with an incomplete rewinding.
    */
   public function testImportWithFailingRewind() {
-    $exception_message = $this->getRandomGenerator()->string();
+    $exception_message = $this->randomString(8);
     $source = $this->getMock('Drupal\migrate\Plugin\MigrateSourceInterface');
     $source->expects($this->once())
       ->method('rewind')
@@ -231,7 +231,7 @@ public function testImportWithValidRowNoDestinationValues() {
    * destination.
    */
   public function testImportWithValidRowWithDestinationMigrateException() {
-    $exception_message = $this->getRandomGenerator()->string();
+    $exception_message = $this->randomString(8);
     $source = $this->getMockSource();
 
     $row = $this->getMockBuilder('Drupal\migrate\Row')
@@ -282,7 +282,7 @@ public function testImportWithValidRowWithDestinationMigrateException() {
    * plugin.
    */
   public function testImportWithValidRowWithProcesMigrateException() {
-    $exception_message = $this->getRandomGenerator()->string();
+    $exception_message = $this->randomString(8);
     $source = $this->getMockSource();
 
     $row = $this->getMockBuilder('Drupal\migrate\Row')
@@ -328,7 +328,7 @@ public function testImportWithValidRowWithProcesMigrateException() {
    * Tests the import method with a regular Exception being thrown.
    */
   public function testImportWithValidRowWithException() {
-    $exception_message = $this->getRandomGenerator()->string();
+    $exception_message = $this->randomString(8);
     $source = $this->getMockSource();
 
     $row = $this->getMockBuilder('Drupal\migrate\Row')
diff --git a/core/tests/Drupal/Tests/UnitTestCase.php b/core/tests/Drupal/Tests/UnitTestCase.php
index 3433c94..e65a777 100644
--- a/core/tests/Drupal/Tests/UnitTestCase.php
+++ b/core/tests/Drupal/Tests/UnitTestCase.php
@@ -8,10 +8,10 @@
 namespace Drupal\Tests;
 
 use Drupal\Component\FileCache\FileCacheFactory;
-use Drupal\Component\Utility\Random;
 use Drupal\Component\Utility\SafeMarkup;
 use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\simpletest\RandomGeneratorTrait;
 
 /**
  * Provides a base class and helpers for Drupal unit tests.
@@ -21,11 +21,9 @@
 abstract class UnitTestCase extends \PHPUnit_Framework_TestCase {
 
   /**
-   * The random generator.
-   *
-   * @var \Drupal\Component\Utility\Random
+   * This test handler uses the Drupal\simpletest\RandomGeneratorTrait
    */
-  protected $randomGenerator;
+  use RandomGeneratorTrait;
 
   /**
    * The app root.
@@ -57,34 +55,6 @@ protected function setUp() {
   }
 
   /**
-   * Generates a unique random string containing letters and numbers.
-   *
-   * @param int $length
-   *   Length of random string to generate.
-   *
-   * @return string
-   *   Randomly generated unique string.
-   *
-   * @see \Drupal\Component\Utility\Random::name()
-   */
-  public function randomMachineName($length = 8) {
-    return $this->getRandomGenerator()->name($length, TRUE);
-  }
-
-  /**
-   * Gets the random generator for the utility methods.
-   *
-   * @return \Drupal\Component\Utility\Random
-   *   The random generator
-   */
-  protected function getRandomGenerator() {
-    if (!is_object($this->randomGenerator)) {
-      $this->randomGenerator = new Random();
-    }
-    return $this->randomGenerator;
-  }
-
-  /**
    * Asserts if two arrays are equal by sorting them first.
    *
    * @param array $expected
