diff --git a/core/modules/simpletest/src/RandomGeneratorTrait.php b/core/modules/simpletest/src/RandomGeneratorTrait.php
index 70087ce..67a663e 100644
--- a/core/modules/simpletest/src/RandomGeneratorTrait.php
+++ b/core/modules/simpletest/src/RandomGeneratorTrait.php
@@ -8,6 +8,7 @@
 namespace Drupal\simpletest;
 
 use Drupal\Component\Utility\Random;
+use Drupal\Component\Utility\Unicode;
 
 /**
  * Provides random generator utility methods.
@@ -89,14 +90,36 @@ public function randomStringValidate($string) {
    *
    * @param int $length
    *   Length of random string to generate.
+   * @param bool $lowercase
+   *   (optional) If the generated machine name is forced to lowercase. Defaults
+   *   to FALSE.
    *
    * @return string
    *   Randomly generated unique string.
    *
    * @see \Drupal\Component\Utility\Random::name()
    */
-  protected function randomMachineName($length = 8) {
-    return $this->getRandomGenerator()->name($length, TRUE);
+  protected function randomMachineName($length = 8, $lowercase = FALSE) {
+    $machine_name = $this->getRandomGenerator()->name($length, TRUE);
+    return $lowercase ? Unicode::strtolower($machine_name) : $machine_name;
+  }
+
+  /**
+   * Generates a unique lowercase random string containing letters and numbers.
+   *
+   * Do not use this method when testing unvalidated user input. Instead, use
+   * \Drupal\simpletest\TestBase::randomString().
+   *
+   * @param int $length
+   *   Length of random string to generate.
+   *
+   * @return string
+   *   Randomly generated unique string.
+   *
+   * @see \Drupal\simpletest\RandomGeneratorTrait::randomMachineName()
+   */
+  protected function randomLowercaseMachineName($length = 8) {
+    return $this->randomMachineName($length, TRUE);
   }
 
   /**
