<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class RandomUtil { public static function number($B_wI5) { $uuIcS = '0123456789'; return substr(str_shuffle(str_repeat($uuIcS, $B_wI5)), 0, $B_wI5); } public static function string($B_wI5) { $uuIcS = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($uuIcS, $B_wI5)), 0, $B_wI5); } public static function readableString($B_wI5) { $uuIcS = '2345678abcdefghijkmnoprstuvwxyzABCDEFGHIJKMNPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($uuIcS, $B_wI5)), 0, $B_wI5); } public static function hexString($B_wI5) { $uuIcS = '0123456789abcdef'; return substr(str_shuffle(str_repeat($uuIcS, $B_wI5)), 0, $B_wI5); } public static function lowerString($B_wI5) { $uuIcS = '0123456789abcdefghijklmnopqrstuvwxyz'; return substr(str_shuffle(str_repeat($uuIcS, $B_wI5)), 0, $B_wI5); } public static function lowerChar($B_wI5) { $uuIcS = 'abcdefghijklmnopqrstuvwxyz'; return substr(str_shuffle(str_repeat($uuIcS, $B_wI5)), 0, $B_wI5); } public static function upperChar($B_wI5) { $uuIcS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($uuIcS, $B_wI5)), 0, $B_wI5); } public static function upperString($B_wI5) { $uuIcS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($uuIcS, $B_wI5)), 0, $B_wI5); } public static function uuid() { return date('Ymd') . '-' . date('Hi') . '-' . date('s') . self::hexString(2) . '-' . self::hexString(4) . '-' . self::hexString(12); } public static function percent($tzAUI) { return rand(0, 99) < $tzAUI; } public static function dateCollection($B_wI5 = 10) { goto E1Iz8; ofPDP: return $I_JnK; goto QFRXj; E1Iz8: $I_JnK = array(); goto ejTpW; ejTpW: for ($K3Ni_ = time() - $B_wI5 * TimeUtil::MINUTE_PERIOD_DAY; $K3Ni_ <= time(); $K3Ni_ += TimeUtil::MINUTE_PERIOD_DAY) { $I_JnK[] = date('Y-m-d', $K3Ni_); } goto ofPDP; QFRXj: } public static function numberCollection($B_wI5 = 10, $uTVb_ = 10, $Wso3J = 100) { goto FedFV; YAFao: for ($K3Ni_ = 0; $K3Ni_ < $B_wI5; $K3Ni_++) { $I_JnK[] = rand($uTVb_, $Wso3J); } goto TucDg; FedFV: $I_JnK = array(); goto YAFao; TucDg: return $I_JnK; goto pKOpB; pKOpB: } }