Index: modules/aggregator/aggregator.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.test,v
retrieving revision 1.22
diff -u -r1.22 aggregator.test
--- modules/aggregator/aggregator.test	2 Apr 2009 20:50:37 -0000	1.22
+++ modules/aggregator/aggregator.test	28 Apr 2009 02:39:01 -0000
@@ -7,8 +7,6 @@
  */
 
 class AggregatorTestCase extends DrupalWebTestCase {
-  private static $prefix = 'simpletest_aggregator_';
-
   function setUp() {
     parent::setUp('aggregator', 'aggregator_test');
     $web_user = $this->drupalCreateUser(array('administer news feeds', 'access news feeds', 'create article content'));
@@ -55,7 +53,7 @@
    *   A feed array.
    */
   function getFeedEditArray($feed_url = NULL) {
-    $feed_name = $this->randomName(10, self::$prefix);
+    $feed_name = $this->randomName(10);
     if (!$feed_url) {
       $feed_url = $GLOBALS['base_url'] . '/rss.xml?feed=' . $feed_name;
     }
@@ -452,8 +450,6 @@
 }
 
 class CategorizeFeedItemTestCase extends AggregatorTestCase {
-  private static $prefix = 'simpletest_aggregator_';
-
   public static function getInfo() {
     return array(
       'name' => t('Categorize feed item functionality'),
@@ -470,7 +466,7 @@
     $this->createSampleNodes();
 
     // 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'])));
 
@@ -511,8 +507,6 @@
 }
 
 class ImportOPMLTestCase extends AggregatorTestCase {
-  private static $prefix = 'simpletest_aggregator_';
-
   public static function getInfo() {
     return array(
       'name' => t('Import feeds from OPML functionality'),
@@ -527,7 +521,7 @@
   function openImportForm() {
     db_delete('aggregator_category')->execute();
 
-    $category = $this->randomName(10, self::$prefix);
+    $category = $this->randomName(10);
     $cid = db_insert('aggregator_category')
       ->fields(array(
         'title' => $category,
@@ -590,7 +584,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.8
diff -u -r1.8 tracker.test
--- modules/tracker/tracker.test	22 Apr 2009 09:57:10 -0000	1.8
+++ modules/tracker/tracker.test	28 Apr 2009 02:39:02 -0000
@@ -29,11 +29,11 @@
     $this->drupalLogin($this->user);
 
     $page1 = array(
-      'title' => $this->randomName(4, 'published_'),
+      'title' => $this->randomName(8),
       'status' => 1,
     );
     $page2 = array(
-      'title' => $this->randomName(4, 'unpublished_'),
+      'title' => $this->randomName(8),
       'status' => 0,
     );
     $this->drupalCreateNode($page1);
@@ -52,12 +52,12 @@
     $this->drupalLogin($this->user);
 
     $page1 = array(
-      'title' => $this->randomName(4, 'published_'),
+      'title' => $this->randomName(8),
       'uid' => $this->user->uid,
       'status' => 1,
     );
     $page2 = array(
-      'title' => $this->randomName(4, 'unpublished_'),
+      'title' => $this->randomName(8),
       'uid' => $this->user->uid,
       'status' => 0,
     );
Index: modules/simpletest/tests/cache.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/cache.test,v
retrieving revision 1.4
diff -u -r1.4 cache.test
--- modules/simpletest/tests/cache.test	31 Mar 2009 01:49:53 -0000	1.4
+++ modules/simpletest/tests/cache.test	28 Apr 2009 02:39:02 -0000
@@ -114,7 +114,7 @@
    * Test the saving and restoring of a string.
    */
   function testString() {
-    $this->checkVariable($this->randomName('100'));
+    $this->checkVariable($this->randomName(100));
   }
 
   /**
@@ -143,7 +143,7 @@
    */
   function testObject() {
     $test_object = new stdClass();
-    $test_object->test1 = $this->randomName('100');
+    $test_object->test1 = $this->randomName(100);
     $test_object->test2 = 100;
     $test_object->test3 = array('drupal1', 'drupal2' => 'drupal3', 'drupal4' => array('drupal5', 'drupal6'));
 
Index: modules/simpletest/drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v
retrieving revision 1.98
diff -u -r1.98 drupal_web_test_case.php
--- modules/simpletest/drupal_web_test_case.php	25 Apr 2009 22:35:49 -0000	1.98
+++ modules/simpletest/drupal_web_test_case.php	28 Apr 2009 02:39:02 -0000
@@ -120,7 +120,7 @@
    * Time limit for the test.
    */
   protected $timeLimit = 180;
-  
+
   /**
    * HTTP authentication credentials (<username>:<password>).
    */
@@ -519,7 +519,7 @@
 
     // Add the default teaser.
     if (!isset($settings['teaser'])) {
-      $settings['teaser'] = $settings['body'];      
+      $settings['teaser'] = $settings['body'];
     }
 
     // If the node's user uid is not specified manually, use the currently
@@ -554,7 +554,7 @@
   protected function drupalCreateContentType($settings = array()) {
     // find a non-existent random type name.
     do {
-      $name = strtolower($this->randomName(3, 'type_'));
+      $name = strtolower($this->randomName(8));
     } while (node_get_types('type', $name));
 
     // Populate defaults array
@@ -641,27 +641,47 @@
   }
 
   /**
-   * 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.
    */
-  public static 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';
-      }
+  public static function randomString($length = 8) {
+    global $db_prefix;
+
+    $str = '';
+    for ($i = 0; $i < $length; $i++) {
+      $str .= chr(mt_rand(32, 126));
     }
-    return $prefix;
+    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.
+   */
+  public static 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 $db_prefix . $str;
+   }
+
+  /**
    * Create a user with a given set of permissions. The permissions correspond to the
    * names given on the privileges page.
    *
Index: modules/profile/profile.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.test,v
retrieving revision 1.12
diff -u -r1.12 profile.test
--- modules/profile/profile.test	31 Mar 2009 01:49:53 -0000	1.12
+++ modules/profile/profile.test	28 Apr 2009 02:39:01 -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(8);
     $edit['name'] = $form_name = 'profile_' . $title;
     $edit['category'] = $category;
     $edit['explanation'] = $this->randomName(50);
@@ -224,8 +224,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(8));
+    $this->setProfileField($field2, $this->randomName(8));
 
     $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.'));
