Level 27
Yes, but unlikely. You have 36 to the power of 40 possible (case insensitive) combinations. That's a very big number. Laravel uses Str::random(60) internally to create the "remember me" tokens for a user for example.
1 like
Is there a possibility of a same string being generated twice with below Laravel string helper?
$random = Str::random(40);
I want to create unique account codes
@kenprogrammer being random, its entirely possible you might generate the same string again.
if you are issuing these to a user and are storing them in a table, you can generate your code, and check it against an existing code. if it matches, just generate another.
Please or to participate in this conversation.