private static function _arrayPick($pool, $len, $glue) { $pool = self::json($pool); if (is_string($pool)) { $tmp = explode('|', $pool); if (count($tmp) > 1) { $pool = $tmp; } } $size = is_array($pool) ? count($pool) : mb_strlen($pool); $indexes = array(); while (1) { $index = Basic::natural(0, $size - 1); $indexes[$index] = $index; if (count($indexes) == $len) { break; } } $values = array(); foreach ($indexes as $index) { $values[] = is_array($pool) ? $pool[$index] : mb_substr($pool, $index, 1); } if ($glue == null) { return $values; } return implode($glue, $values); }
private static function _randomTime($min = false, $max = false) { // min, max if ($min == false) { $min = 0; } if ($max == false) { $max = time(); } return Basic::natural($min, $max); }
public static function d100() { return Basic::natural(1, 100); }