JSFiddle - React, Tailwind, and code Playground
JavaScript
var seed, nums, c;
seed = [];
nums = [];
c = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz!@#$%^&*()";
window.addEventListener("mousemove", function (e) {
if (nums.join('').indexOf(e.offsetX + e.offsetY) >= 0) {
seed.push(parseInt(nums.join('')));
nums = [];
seed.length > 256 ? nums.splice(0, 1) : 1;
}
nums.push(e.offsetX);
nums.push(e.offsetY);
});
var random = function (l, r) {
r = r || '';
if (l === 0) {
return r;
} else {
return random(l - 1, r + c[seed[seed.length - l] % c.length]);
}
}
window.addEventListener("click", function () {
var pass = random(parseInt(window.prompt("How many characters should this password be?")));
alert(pass);
});