vscode: yet another refactor commit

This commit is contained in:
Veetaha 2020-02-05 00:13:46 +02:00
parent c9e1aab880
commit b89b22e43e
7 changed files with 30 additions and 35 deletions

View file

@ -69,7 +69,7 @@ interface Decoration {
// Based on this HSL-based color generator: https://gist.github.com/bendc/76c48ce53299e6078a76
function fancify(seed: string, shade: 'light' | 'dark') {
const random = randomU32Numbers(hashString(seed))
const random = randomU32Numbers(hashString(seed));
const randomInt = (min: number, max: number) => {
return Math.abs(random()) % (max - min + 1) + min;
};
@ -253,14 +253,14 @@ function randomU32Numbers(seed: number) {
random ^= random >> 17;
random ^= random << 5;
random |= 0;
return random
}
return random;
};
}
function hashString(str: string): number {
let res = 0;
for (let i = 0; i < str.length; ++i) {
const c = str.codePointAt(i)!!;
const c = str.codePointAt(i)!;
res = (res * 31 + c) & ~0;
}
return res;