public function generate() { return substr($this->generator->generate(), 0, $this->maxLength); }
/** * Generates Unique Random Account No */ public static function generateUniqueAccountNo () { $customAlphabet = '0123456789'; // Set initial alphabet. $generator = new RandomStringGenerator($customAlphabet); // Change alphabet whenever needed. $generator->setAlphabet($customAlphabet); // Set token length. $tokenLength = 14; // Call method to generate random string. $token = $generator->generate($tokenLength); return $token; }