random password generator
function CreatePassword(PassLenght) {
const Lenght = parseInt(PassLenght)
const Charecters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
let Password = "";
for (var i = 0, n = Charecters.length; i < Lenght; ++i) { Password += Charecters.charAt(Math.floor(Math.random() * n)); }
console.log(Password)
return Password;
}
CreatePassword(18)
0
7
function rand_string( $length ) {
$str = "";
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$size = strlen( $chars );
for( $i = 0; $i < $length; $i++ ) {
$str .= $chars[ rand( 0, $size - 1 ) ];
}
return $str;
}
//and call the function this way:
$mypass = rand_string(10);
Thank you!
7
0
4.33
9
import string
from random import *
characters = string.ascii_letters + string.digits
Password = "".join(choice(characters) for x in range(randint(8, 16)))
print(Password)
Thank you!
9
0
0
0
var btn = document.getElementById("btn");
btn.addEventListener("click", function generate() {
var generatePassword = "";
var password = document.getElementById("password");
var characters =
"abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*?";
for (var i = 0; i < 10; i++) {
generatePassword += characters.charAt(
Math.floor(Math.random() * characters.length)
);
}
password.innerHTML = generatePassword;
});
Thank you!
0
0
Are there any code examples left?
New code examples in category PHP
-
PHP 2022-03-28 00:40:03 index:of curiosa 2019 mp4
-
PHP 2022-03-28 00:35:13 Dijkstra’s algorithm php
-
PHP 2022-03-28 00:35:12 get_declared_classes
-
PHP 2022-03-28 00:30:23 php move index of a value to first position in array
-
PHP 2022-03-28 00:25:01 wordpress get_date
-
PHP 2022-03-27 23:30:38 php shorten string with dots
-
PHP 2022-03-27 23:10:46 php header 500
-
PHP 2022-03-27 23:05:06 laravel schedule run
-
PHP 2022-03-27 22:25:12 Get page title, excerpt or content by id
-
PHP 2022-03-27 22:00:27 php convert date from dd/mm/yyyy to yyyy-mm-dd