<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class RandomUtil { public static function number($zLhEa) { $Lu34J = '0123456789'; return substr(str_shuffle(str_repeat($Lu34J, $zLhEa)), 0, $zLhEa); } public static function string($zLhEa) { $Lu34J = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($Lu34J, $zLhEa)), 0, $zLhEa); } public static function readableString($zLhEa) { $Lu34J = '2345678abcdefghijkmnoprstuvwxyzABCDEFGHIJKMNPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($Lu34J, $zLhEa)), 0, $zLhEa); } public static function lowerReadableString($zLhEa) { return strtolower(self::readableString($zLhEa)); } public static function upperReadableString($zLhEa) { return strtoupper(self::readableString($zLhEa)); } public static function hexString($zLhEa) { $Lu34J = '0123456789abcdef'; return substr(str_shuffle(str_repeat($Lu34J, $zLhEa)), 0, $zLhEa); } public static function lowerString($zLhEa) { $Lu34J = '0123456789abcdefghijklmnopqrstuvwxyz'; return substr(str_shuffle(str_repeat($Lu34J, $zLhEa)), 0, $zLhEa); } public static function lowerChar($zLhEa) { $Lu34J = 'abcdefghijklmnopqrstuvwxyz'; return substr(str_shuffle(str_repeat($Lu34J, $zLhEa)), 0, $zLhEa); } public static function upperChar($zLhEa) { $Lu34J = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($Lu34J, $zLhEa)), 0, $zLhEa); } public static function upperString($zLhEa) { $Lu34J = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; return substr(str_shuffle(str_repeat($Lu34J, $zLhEa)), 0, $zLhEa); } public static function uuid() { return date('Ymd') . '-' . date('Hi') . '-' . date('s') . self::hexString(2) . '-' . self::hexString(4) . '-' . self::hexString(12); } public static function percent($gwXrh) { return rand(0, 99) < $gwXrh; } public static function dateCollection($zLhEa = 10) { goto RJ86a; RJ86a: $FZE6h = array(); goto YP0xP; YP0xP: $RoVl5 = time(); goto BSrbF; mUHIz: return $FZE6h; goto stKVS; BSrbF: for ($VJ5vg = $RoVl5 - $zLhEa * TimeUtil::MINUTE_PERIOD_DAY; $VJ5vg < $RoVl5; $VJ5vg += TimeUtil::MINUTE_PERIOD_DAY) { $FZE6h[] = date('Y-m-d', $VJ5vg); } goto mUHIz; stKVS: } public static function numberCollection($zLhEa = 10, $VRHMd = 10, $mymfi = 100) { goto ZgZWP; u6zqm: return $FZE6h; goto l1Qec; ZgZWP: $FZE6h = array(); goto FOeUe; FOeUe: for ($VJ5vg = 0; $VJ5vg < $zLhEa; $VJ5vg++) { $FZE6h[] = rand($VRHMd, $mymfi); } goto u6zqm; l1Qec: } }