You are here

function charts_graphs_random_hash in Charts and Graphs 7

Same name and namespace in other branches
  1. 6.2 charts_graphs.module \charts_graphs_random_hash()
  2. 7.2 charts_graphs.module \charts_graphs_random_hash()

Random, unique string generator, to be used for cache_id in async data retrieval.

Return value

<string>

2 calls to charts_graphs_random_hash()
ChartsGraphsAmcharts::get_chart in apis/charts_graphs_amcharts/charts_graphs_amcharts.class.inc
Function that renders data.
ChartsGraphsOpenFlash::get_chart in apis/charts_graphs_open_flash/charts_graphs_open_flash.class.inc
Function that renders data.

File

./charts_graphs.module, line 229

Code

function charts_graphs_random_hash() {
  list($usec, $sec) = explode(' ', microtime());
  $seed = (double) $sec + (double) $usec * 100000;
  mt_srand($seed);
  $randval1 = (string) mt_rand();
  $randval2 = (string) mt_rand();
  $randval3 = (string) mt_rand();
  $rand = $randval1 . $randval2 . $randval3;
  $randhash = md5($rand);
  return 'chgr_' . (string) $randhash;
}