乱数の初期化方法

PHP版RANDOMIZE VAL(TIME)の方法。

// マイクロ秒でシードを設定します
function make_seed()
{
  list($usec, $sec) = explode(' ', microtime());
  return (float) $sec + *1;
$randval = rand();

explodeはsplitの正規表現版じゃないやつ。


PHP: srand関数 乱数ジェネレータを初期化する
http://php.plus-server.net/function.srand.html


explode()関数/PHP関数リファレンス
http://www.scollabo.com/banban/php/ref/ref_explode.html


PHP: microtime - Manual
http://php.benscom.com/manual/ja/function.microtime.php

*1:float) $usec * 100000); } srand(make_seed(