Index: modules/profile/profile.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.test,v
retrieving revision 1.7
diff -u -r1.7 profile.test
--- modules/profile/profile.test	10 Oct 2008 07:49:49 -0000	1.7
+++ modules/profile/profile.test	10 Nov 2008 02:08:00 -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/simpletest/drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v
retrieving revision 1.56
diff -u -r1.56 drupal_web_test_case.php
--- modules/simpletest/drupal_web_test_case.php	9 Nov 2008 03:07:54 -0000	1.56
+++ modules/simpletest/drupal_web_test_case.php	10 Nov 2008 02:08:00 -0000
@@ -413,7 +413,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
@@ -499,26 +499,46 @@
       return $compare_size;
     }
   }
+  
+  /**
+   * Generates a random string of ASCI characters of codes 32 to 126. That
+   * includes alpha-numeric characters and common misc characters.
+   *
+   * @param $length
+   *   Length of random string to generate which will be appended to $db_prefx.
+   * @return
+   *   Randomly generated string.
+   */
+  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.
+   * 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 $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 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/aggregator/aggregator.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.test,v
retrieving revision 1.14
diff -u -r1.14 aggregator.test
--- modules/aggregator/aggregator.test	7 Nov 2008 07:12:52 -0000	1.14
+++ modules/aggregator/aggregator.test	10 Nov 2008 02:08:00 -0000
@@ -2,8 +2,6 @@
 // $Id: aggregator.test,v 1.14 2008/11/07 07:12:52 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,
@@ -445,7 +443,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'])));
 
@@ -499,7 +497,7 @@
   function openImportForm() {
     db_delete('aggregator_category')->execute();
 
-    $category = $this->randomName(10, self::$prefix);
+    $category = $this->randomName(10);
     db_insert('aggregator_category')
       ->fields(array(
         'cid' => 1,
@@ -563,7 +561,7 @@
     db_delete('aggregator_category')->execute();
     db_delete('aggregator_category_feed')->execute();
 
-    $category = $this->randomName(10, self::$prefix);
+    $category = $this->randomName(10);
     db_insert('aggregator_category')
       ->fields(array(
         'cid' => 1,
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	10 Nov 2008 02:08:00 -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,
     );
