<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class RandomUtil { public static function number($snD3e) { $jUsq1 = '0123456789'; return substr(str_shuffle(str_repeat($jUsq1, $snD3e)), 0, $snD3e); } public static function string($snD3e) { $jUsq1 = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($jUsq1, $snD3e)), 0, $snD3e); } public static function readableString($snD3e) { $jUsq1 = '2345678abcdefghijkmnoprstuvwxyzABCDEFGHIJKMNPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($jUsq1, $snD3e)), 0, $snD3e); } public static function lowerReadableString($snD3e) { return strtolower(self::readableString($snD3e)); } public static function upperReadableString($snD3e) { return strtoupper(self::readableString($snD3e)); } public static function hexString($snD3e) { $jUsq1 = '0123456789abcdef'; return substr(str_shuffle(str_repeat($jUsq1, $snD3e)), 0, $snD3e); } public static function lowerString($snD3e) { $jUsq1 = '0123456789abcdefghijklmnopqrstuvwxyz'; return substr(str_shuffle(str_repeat($jUsq1, $snD3e)), 0, $snD3e); } public static function lowerChar($snD3e) { $jUsq1 = 'abcdefghijklmnopqrstuvwxyz'; return substr(str_shuffle(str_repeat($jUsq1, $snD3e)), 0, $snD3e); } public static function upperChar($snD3e) { $jUsq1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($jUsq1, $snD3e)), 0, $snD3e); } public static function upperString($snD3e) { $jUsq1 = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($jUsq1, $snD3e)), 0, $snD3e); } public static function uuid() { return date('Ymd') . '-' . date('Hi') . '-' . date('s') . self::hexString(2) . '-' . self::hexString(4) . '-' . self::hexString(12); } public static function percent($HDpl6) { return rand(0, 99) < $HDpl6; } public static function dateCollection($snD3e = 10) { goto OlkJH; gZZ6q: $HjXRV = time(); goto gY4JM; OlkJH: $CEqzM = array(); goto gZZ6q; gY4JM: for ($tMyPy = $HjXRV - $snD3e * TimeUtil::MINUTE_PERIOD_DAY; $tMyPy < $HjXRV; $tMyPy += TimeUtil::MINUTE_PERIOD_DAY) { $CEqzM[] = date('Y-m-d', $tMyPy); } goto zOGdc; zOGdc: return $CEqzM; goto Fq6ru; Fq6ru: } public static function numberCollection($snD3e = 10, $B7NHd = 10, $y1uR1 = 100) { goto N7DxT; q1OpD: return $CEqzM; goto NHZfp; cBk6o: for ($tMyPy = 0; $tMyPy < $snD3e; $tMyPy++) { $CEqzM[] = rand($B7NHd, $y1uR1); } goto q1OpD; N7DxT: $CEqzM = array(); goto cBk6o; NHZfp: } }