diff --git a/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php b/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php
index f9f97ec..96b7411 100644
--- a/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php
+++ b/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php
@@ -42,6 +42,13 @@
   protected $configDirectories = [];
 
   /**
+   * Setting unique apcu prefix. See Settings::getApcuPrefix().
+   *
+   * @var bool
+   */
+  protected $apcuEnsureUniquePrefix = FALSE;
+
+  /**
    * Prepares site settings and services before installation.
    */
   protected function prepareSettings() {
@@ -83,6 +90,10 @@ protected function prepareSettings() {
       'value' => $this->originalProfile,
       'required' => TRUE,
     ];
+    $settings['settings']['apcu_ensure_unique_prefix'] = (object) [
+      'value' => $this->apcuEnsureUniquePrefix,
+      'required' => TRUE,
+    ];
     $this->writeSettings($settings);
     // Allow for test-specific overrides.
     $settings_testing_file = DRUPAL_ROOT . '/' . $this->originalSite . '/settings.testing.php';
diff --git a/core/modules/system/tests/src/Functional/Module/ClassLoaderTest.php b/core/modules/system/tests/src/Functional/Module/ClassLoaderTest.php
index 93c0bf3..335a03a 100644
--- a/core/modules/system/tests/src/Functional/Module/ClassLoaderTest.php
+++ b/core/modules/system/tests/src/Functional/Module/ClassLoaderTest.php
@@ -19,6 +19,11 @@ class ClassLoaderTest extends BrowserTestBase {
   protected $expected = 'Drupal\\module_autoload_test\\SomeClass::testMethod() was invoked.';
 
   /**
+   * {@inheritdoc}
+   */
+  protected $apcuEnsureUniquePrefix = TRUE;
+
+  /**
    * Tests that module-provided classes can be loaded when a module is enabled.
    *
    * @see \Drupal\module_autoload_test\SomeClass
diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh
index 407d87a..28c34fd 100755
--- a/core/scripts/run-tests.sh
+++ b/core/scripts/run-tests.sh
@@ -142,6 +142,7 @@
 }
 
 $test_list = simpletest_script_get_test_list();
+shuffle($test_list);
 
 // Try to allocate unlimited time to run the tests.
 drupal_set_time_limit(0);
diff --git a/core/tests/Drupal/Tests/Core/Site/SettingsTest.php b/core/tests/Drupal/Tests/Core/Site/SettingsTest.php
index 5e4f1d0..f72e4ce 100644
--- a/core/tests/Drupal/Tests/Core/Site/SettingsTest.php
+++ b/core/tests/Drupal/Tests/Core/Site/SettingsTest.php
@@ -117,7 +117,7 @@ public function testSerialize() {
    * @covers ::getApcuPrefix
    */
   public function testGetApcuPrefix() {
-    $settings = new Settings(['hash_salt' => 123]);
+    $settings = new Settings(['hash_salt' => 123, 'apcu_ensure_unique_prefix' => TRUE]);
     $this->assertNotEquals($settings::getApcuPrefix('cache_test', '/test/a'), $settings::getApcuPrefix('cache_test', '/test/b'));
 
     $settings = new Settings(['hash_salt' => 123, 'apcu_ensure_unique_prefix' => FALSE]);
