<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class RandomUtil { public static function number($LZaph) { $VDGNx = '0123456789'; return substr(str_shuffle(str_repeat($VDGNx, $LZaph)), 0, $LZaph); } public static function string($LZaph) { $VDGNx = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($VDGNx, $LZaph)), 0, $LZaph); } public static function readableString($LZaph) { $VDGNx = '2345678abcdefghijkmnoprstuvwxyzABCDEFGHIJKMNPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($VDGNx, $LZaph)), 0, $LZaph); } public static function lowerReadableString($LZaph) { return strtolower(self::readableString($LZaph)); } public static function upperReadableString($LZaph) { return strtoupper(self::readableString($LZaph)); } public static function hexString($LZaph) { $VDGNx = '0123456789abcdef'; return substr(str_shuffle(str_repeat($VDGNx, $LZaph)), 0, $LZaph); } public static function lowerString($LZaph) { $VDGNx = '0123456789abcdefghijklmnopqrstuvwxyz'; return substr(str_shuffle(str_repeat($VDGNx, $LZaph)), 0, $LZaph); } public static function lowerChar($LZaph) { $VDGNx = 'abcdefghijklmnopqrstuvwxyz'; return substr(str_shuffle(str_repeat($VDGNx, $LZaph)), 0, $LZaph); } public static function upperChar($LZaph) { $VDGNx = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($VDGNx, $LZaph)), 0, $LZaph); } public static function upperString($LZaph) { $VDGNx = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($VDGNx, $LZaph)), 0, $LZaph); } public static function uuid() { return date('Ymd') . '-' . date('Hi') . '-' . date('s') . self::hexString(2) . '-' . self::hexString(4) . '-' . self::hexString(12); } public static function percent($wvO30) { return rand(0, 99) < $wvO30; } public static function dateCollection($LZaph = 10) { goto vK30p; a8ElG: return $ttiXA; goto QJI_D; hvBKR: for ($UCcmA = $T_NF7 - $LZaph * TimeUtil::MINUTE_PERIOD_DAY; $UCcmA < $T_NF7; $UCcmA += TimeUtil::MINUTE_PERIOD_DAY) { $ttiXA[] = date('Y-m-d', $UCcmA); } goto a8ElG; hb_p4: $T_NF7 = time(); goto hvBKR; vK30p: $ttiXA = array(); goto hb_p4; QJI_D: } public static function numberCollection($LZaph = 10, $ovAVz = 10, $it8Qi = 100) { goto lZP3D; lZP3D: $ttiXA = array(); goto IfNJF; cjFw0: return $ttiXA; goto pP1zf; IfNJF: for ($UCcmA = 0; $UCcmA < $LZaph; $UCcmA++) { $ttiXA[] = rand($ovAVz, $it8Qi); } goto cjFw0; pP1zf: } }