You are here

function ContextUiTest::randomID in Context 5

1 call to ContextUiTest::randomID()
ContextUiTest::testCreateContext in context_ui/tests/context_ui.test

File

context_ui/tests/context_ui.test, line 37

Class

ContextUiTest
Functional Test for Context UI

Code

function randomID($number = 4, $prefix = 'simpletest_') {
  $chars = 'abcdefghijklmnopqrstuvwxyz_';
  for ($x = 0; $x < $number; $x++) {
    $prefix .= $chars[mt_rand(0, strlen($chars) - 1)];
    if ($x == 0) {
      $chars .= '0123456789';
    }
  }
  return $prefix;
}