<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class RandomUtil { public static function number($TcI2W) { $Y9y3V = '0123456789'; return substr(str_shuffle(str_repeat($Y9y3V, $TcI2W)), 0, $TcI2W); } public static function string($TcI2W) { $Y9y3V = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($Y9y3V, $TcI2W)), 0, $TcI2W); } public static function readableString($TcI2W) { $Y9y3V = '2345678abcdefghijkmnoprstuvwxyzABCDEFGHIJKMNPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($Y9y3V, $TcI2W)), 0, $TcI2W); } public static function lowerReadableString($TcI2W) { return strtolower(self::readableString($TcI2W)); } public static function upperReadableString($TcI2W) { return strtoupper(self::readableString($TcI2W)); } public static function hexString($TcI2W) { $Y9y3V = '0123456789abcdef'; return substr(str_shuffle(str_repeat($Y9y3V, $TcI2W)), 0, $TcI2W); } public static function lowerString($TcI2W) { $Y9y3V = '0123456789abcdefghijklmnopqrstuvwxyz'; return substr(str_shuffle(str_repeat($Y9y3V, $TcI2W)), 0, $TcI2W); } public static function lowerChar($TcI2W) { $Y9y3V = 'abcdefghijklmnopqrstuvwxyz'; return substr(str_shuffle(str_repeat($Y9y3V, $TcI2W)), 0, $TcI2W); } public static function upperChar($TcI2W) { $Y9y3V = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($Y9y3V, $TcI2W)), 0, $TcI2W); } public static function upperString($TcI2W) { $Y9y3V = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($Y9y3V, $TcI2W)), 0, $TcI2W); } public static function uuid() { return date('Ymd') . '-' . date('Hi') . '-' . date('s') . self::hexString(2) . '-' . self::hexString(4) . '-' . self::hexString(12); } public static function percent($FT9zA) { return rand(0, 99) < $FT9zA; } public static function dateCollection($TcI2W = 10) { goto gjWwx; s3tmf: return $ddUyu; goto AtX_U; FHj57: for ($eQWJY = time() - $TcI2W * TimeUtil::MINUTE_PERIOD_DAY; $eQWJY <= time(); $eQWJY += TimeUtil::MINUTE_PERIOD_DAY) { $ddUyu[] = date('Y-m-d', $eQWJY); } goto s3tmf; gjWwx: $ddUyu = array(); goto FHj57; AtX_U: } public static function numberCollection($TcI2W = 10, $C02ht = 10, $lFwEO = 100) { goto rINap; rINap: $ddUyu = array(); goto xERk3; xERk3: for ($eQWJY = 0; $eQWJY < $TcI2W; $eQWJY++) { $ddUyu[] = rand($C02ht, $lFwEO); } goto Z5Teq; Z5Teq: return $ddUyu; goto Y3M2Z; Y3M2Z: } }