import { randInt } from "@common/utils";

export const randChar = (min = ' ', max = '~') =>
    String.fromCharCode(randInt(
        min.charCodeAt(0),
        max.charCodeAt(0) + 1,
    ));

export const generateColors = () => {
    const colors: string[] = [];
    for (let i = 0; i < 16; i++) {
        const high = ((i & 0b1000) > 0) ? 'ff' : '7f';

        const b = ((i & 0b0001) > 0) ? high : '00';
        const g = ((i & 0b0010) > 0) ? high : '00';
        const r = ((i & 0b0100) > 0) ? high : '00';

        const color = `#${r}${g}${b}`;
        colors.push(color);
    }

    return colors;
};
