Random Characters Generator

249 views
Skip to first unread message

Soner Gülrodop

unread,
Nov 22, 2019, 9:30:30 AM11/22/19
to UtilFr
Hello all,

I want to make a random character generator with numbers (just like password generator) for writing random file name and it must be around 8 characters. for example ty8Ac3pA

Must be using these characters (abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890)

Can anyone help me?

Thanks.

man...@hotmail.fr

unread,
Dec 10, 2019, 11:06:40 AM12/10/19
to UtilFr
Hello, it's very easy to do, but in what language do you want to do it? I can write it down for you quickly for the web if you want.

Soner Gülrodop

unread,
Dec 16, 2019, 6:09:35 AM12/16/19
to UtilFr
Hi man13or,

Thank you for your interest. Would you mind sharing the codes for the latin alphabet? Latin uppercase, lowercase and numbers please. :)
Message has been deleted

man...@hotmail.fr

unread,
Dec 16, 2019, 8:20:22 AM12/16/19
to UtilFr
Hello,

<?php

$a = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
$result = '';
for ($i=1; $i < 8; ++$i) {
    $result.= $a{mt_rand(0, strlen($a)-1)};
}
echo $result;

?>
Reply all
Reply to author
Forward
0 new messages