Index: modules/profile/profile.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.test,v
retrieving revision 1.6
diff -u -r1.6 profile.test
--- modules/profile/profile.test	5 Jun 2008 21:55:44 -0000	1.6
+++ modules/profile/profile.test	23 Sep 2008 04:17:22 -0000
@@ -31,7 +31,7 @@
    *   The fid of the field that was just created.
    */
   function createProfileField($type = 'textfield', $category = 'simpletest', $edit = array()) {
-    $edit['title'] = $title = $this->randomName(4, $type . '_');
+    $edit['title'] = $title = $this->randomName(4);
     $edit['name'] = $form_name = 'profile_' . $title;
     $edit['category'] = $category;
     $edit['explanation'] = $this->randomName(50);
@@ -237,8 +237,8 @@
     $field1 = $this->createProfileField('textfield', $category, array('weight' => 1));
     $field2 = $this->createProfileField('textfield', $category, array('weight' => -1));
 
-    $this->setProfileField($field1, $this->randomName(4, 'first_'));
-    $this->setProfileField($field2, $this->randomName(4, 'second_'));
+    $this->setProfileField($field1, $this->randomName(4));
+    $this->setProfileField($field2, $this->randomName(4));
 
     $profile_edit = $this->drupalGet('user/' . $this->normal_user->uid . '/edit/' . $category);
     $this->assertTrue(strpos($profile_edit, $field1['title']) > strpos($profile_edit, $field2['title']), t('Profile field weights are respected on the user edit form.'));
Index: modules/aggregator/aggregator.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.test,v
retrieving revision 1.8
diff -u -r1.8 aggregator.test
--- modules/aggregator/aggregator.test	15 Sep 2008 21:06:06 -0000	1.8
+++ modules/aggregator/aggregator.test	23 Sep 2008 04:17:22 -0000
@@ -2,8 +2,6 @@
 // $Id: aggregator.test,v 1.8 2008/09/15 21:06:06 webchick Exp $
 
 class AggregatorTestCase extends DrupalWebTestCase {
-  private static $prefix = 'simpletest_aggregator_';
-
   /**
    * Implementation of setUp().
    */
@@ -44,7 +42,7 @@
    * @return array Feed array.
    */
   function getFeedEditArray() {
-    $feed_name = $this->randomName(10, self::$prefix);
+    $feed_name = $this->randomName(10);
     $feed_url = url(NULL, array('absolute' => TRUE)) . 'rss.xml?feed=' . $feed_name;
     $edit = array(
       'title' => $feed_name,
@@ -430,7 +428,7 @@
    */
   function testCategorizeFeedItem() {
     // Simulate form submission on "admin/content/aggregator/add/category".
-    $edit = array('title' => $this->randomName(10, self::$prefix), 'description' => '');
+    $edit = array('title' => $this->randomName(10), 'description' => '');
     $this->drupalPost('admin/content/aggregator/add/category', $edit, t('Save'));
     $this->assertRaw(t('The category %title has been added.', array('%title' => $edit['title'])), t('The category %title has been added.', array('%title' => $edit['title'])));
 
@@ -480,7 +478,7 @@
   function openImportForm() {
     db_query('DELETE FROM {aggregator_category}');
 
-    $category = $this->randomName(10, self::$prefix);
+    $category = $this->randomName(10);
     db_query("INSERT INTO {aggregator_category} (cid, title, description) VALUES (%d, '%s', '%s')", 1, $category, '');
 
     $this->drupalGet('admin/content/aggregator/add/opml');
@@ -538,7 +536,7 @@
     db_query('DELETE FROM {aggregator_category}');
     db_query('DELETE FROM {aggregator_category_feed}');
 
-    $category = $this->randomName(10, self::$prefix);
+    $category = $this->randomName(10);
     db_query("INSERT INTO {aggregator_category} (cid, title, description) VALUES (%d, '%s', '%s')", 1, $category, '');
 
     $feeds[0] = $this->getFeedEditArray();
Index: modules/simpletest/drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v
retrieving revision 1.45
diff -u -r1.45 drupal_web_test_case.php
--- modules/simpletest/drupal_web_test_case.php	20 Sep 2008 20:22:24 -0000	1.45
+++ modules/simpletest/drupal_web_test_case.php	23 Sep 2008 04:17:23 -0000
@@ -414,7 +414,7 @@
   function drupalCreateContentType($settings = array()) {
     // find a non-existent random type name.
     do {
-      $name = strtolower($this->randomName(3, 'type_'));
+      $name = strtolower($this->randomName(3));
     } while (node_get_types('type', $name));
 
     // Populate defaults array
@@ -496,24 +496,44 @@
   }
 
   /**
-   * Generates a random string.
+   * Generates a random string of ASCI characters of codes 32 to 126. That
+   * includes alpha-numeric characters and common misc characters.
    *
-   * @param $number
-   *   Number of characters in length to append to the prefix.
-   * @param $prefix
-   *   Prefix to use.
+   * @param $length
+   *   Length of random string to generate which will be appended to $db_prefx.
    * @return
    *   Randomly generated string.
    */
-  function randomName($number = 4, $prefix = 'simpletest_') {
-    $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_';
-    for ($x = 0; $x < $number; $x++) {
-      $prefix .= $chars{mt_rand(0, strlen($chars) - 1)};
-      if ($x == 0) {
-        $chars .= '0123456789';
-      }
+  function randomString($length = 8) {
+    global $db_prefix;
+
+    $str = '';
+    for ($i = 0; $i < $length; $i++) {
+      $str .= chr(mt_rand(32, 126));
+    }
+    return $db_prefix . $str;
+  }
+
+  /**
+   * Generates a random string containing letters, both capital and lower, and
+   * numbers. This method is better for restricted inputs that don't accept
+   * certain characters.
+   *
+   * @param $length
+   *   Length of random string to generate which will be appended to $db_prefx.
+   * @return
+   *   Randomly generated string.
+   */
+  function randomName($length = 8) {
+    global $db_prefix;
+
+    $values = array_merge(range(65, 90), range(97, 122), range(48, 57));
+    $max = count($values) - 1;
+    $str = '';
+    for ($i = 0; $i < $length; $i++) {
+      $str .= chr($values[mt_rand(0, $max)]);
     }
-    return $prefix;
+    return $db_prefix . $str;
   }
 
   /**
Index: modules/tracker/tracker.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/tracker/tracker.test,v
retrieving revision 1.4
diff -u -r1.4 tracker.test
--- modules/tracker/tracker.test	21 Sep 2008 22:15:52 -0000	1.4
+++ modules/tracker/tracker.test	23 Sep 2008 04:17:23 -0000
@@ -35,11 +35,11 @@
     $this->drupalLogin($this->user);
 
     $page1 = array(
-      'title' => $this->randomName(4, 'published_'),
+      'title' => $this->randomName(4),
       'status' => 1,
     );
     $page2 = array(
-      'title' => $this->randomName(4, 'unpublished_'),
+      'title' => $this->randomName(4),
       'status' => 0,
     );
     $this->drupalCreateNode($page1);
@@ -57,12 +57,12 @@
     $this->drupalLogin($this->user);
 
     $page1 = array(
-      'title' => $this->randomName(4, 'published_'),
+      'title' => $this->randomName(4),
       'uid' => $this->user->uid,
       'status' => 1,
     );
     $page2 = array(
-      'title' => $this->randomName(4, 'unpublished_'),
+      'title' => $this->randomName(4),
       'uid' => $this->user->uid,
       'status' => 0,
     );
