<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class RandomUtil { public static function number($igmtR) { $F4PfP = '0123456789'; return substr(str_shuffle(str_repeat($F4PfP, $igmtR)), 0, $igmtR); } public static function string($igmtR) { $F4PfP = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($F4PfP, $igmtR)), 0, $igmtR); } public static function readableString($igmtR) { $F4PfP = '2345678abcdefghijkmnoprstuvwxyzABCDEFGHIJKMNPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($F4PfP, $igmtR)), 0, $igmtR); } public static function lowerReadableString($igmtR) { return strtolower(self::readableString($igmtR)); } public static function upperReadableString($igmtR) { return strtoupper(self::readableString($igmtR)); } public static function hexString($igmtR) { $F4PfP = '0123456789abcdef'; return substr(str_shuffle(str_repeat($F4PfP, $igmtR)), 0, $igmtR); } public static function lowerString($igmtR) { $F4PfP = '0123456789abcdefghijklmnopqrstuvwxyz'; return substr(str_shuffle(str_repeat($F4PfP, $igmtR)), 0, $igmtR); } public static function lowerChar($igmtR) { $F4PfP = 'abcdefghijklmnopqrstuvwxyz'; return substr(str_shuffle(str_repeat($F4PfP, $igmtR)), 0, $igmtR); } public static function upperChar($igmtR) { $F4PfP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($F4PfP, $igmtR)), 0, $igmtR); } public static function upperString($igmtR) { $F4PfP = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($F4PfP, $igmtR)), 0, $igmtR); } public static function uuid() { return date('Ymd') . '-' . date('Hi') . '-' . date('s') . self::hexString(2) . '-' . self::hexString(4) . '-' . self::hexString(12); } public static function percent($cBDsM) { return rand(0, 99) < $cBDsM; } public static function dateCollection($igmtR = 10) { goto ZiWye; BcdnP: $fLEeX = time(); goto xAlou; QbYid: return $xOkS0; goto AolN9; ZiWye: $xOkS0 = array(); goto BcdnP; xAlou: for ($jqibn = $fLEeX - $igmtR * TimeUtil::MINUTE_PERIOD_DAY; $jqibn < $fLEeX; $jqibn += TimeUtil::MINUTE_PERIOD_DAY) { $xOkS0[] = date('Y-m-d', $jqibn); } goto QbYid; AolN9: } public static function numberCollection($igmtR = 10, $j5Pz1 = 10, $ieIY5 = 100) { goto l3DiG; WdMm8: return $xOkS0; goto MmUSk; l3DiG: $xOkS0 = array(); goto tA9Ts; tA9Ts: for ($jqibn = 0; $jqibn < $igmtR; $jqibn++) { $xOkS0[] = rand($j5Pz1, $ieIY5); } goto WdMm8; MmUSk: } }