Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function seededColours(seedString) {
- let charHash = "";
- let i;
- for (i of seedString) {
- charHash += i.charCodeAt(0);
- }
- const hash = parseInt(charHash, 10);
- const rSeed = seededRandom(hash);
- const gSeed = seededRandom(rSeed * hash);
- const bSeed = seededRandom(gSeed * hash);
- const r = Math.floor(rSeed * 256);
- const g = Math.floor(gSeed * 256);
- const b = Math.floor(bSeed * 256);
- return `rgb(${r},${g},${b})`;
- }
- function seededRandom(seed) {
- return ((seed * 9301 + 49297) % 233280) / 233280;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement