export type Options = { major: boolean, minor: boolean, seventh: boolean, minorSeventh: boolean, majorSeventh: boolean, } export function generate(o: Options): [string, string] { let base = all[Math.floor(Math.random() * all.length)] let alterations: string[] = [] if (o.major) alterations = alterations.concat('') if (o.minor) alterations = alterations.concat('-') if (o.seventh) alterations = alterations.concat('7') if (o.minorSeventh) alterations = alterations.concat('-7') if (o.majorSeventh) alterations = alterations.concat('7') return [base, alterations[Math.floor(Math.random() * alterations.length)]] } const all: string[] = [ 'C', 'D♭', 'D', 'E♭', 'E', 'F', 'G♭', 'G', 'A♭', 'A', 'B♭', 'B' ]