I would suggest generating random RGB values (combine three random numbers) and then create a function that measures the color difference between your generated random color and the ones in your data structure. If your generated color is too close to one you already have, generate a new one. You will have to decide how "different" you want the random color to be from what you already have, but a difference of only a few points in R, G an B won't be discernibly different so you should be looking for some minimum separation in at least one channel.
Searching for "calculate rgb color difference" gives you a bunch of references on how to calculate a meaningful difference between two color values. This link from that search has a specific equation and here's a previous question on SO about color differences.
You can also generate complementary colors from what you already have if you just want different colors and don't need/want truly random colors.
You could generate a random color like this in either data form or hex string form:
// generate r,g,b data structure like {r: 255, g: 30, b: 09}
function generateRandomColorData() {
function randomColorVal() {
return(Math.floor(Math.random() * 256));
}
return {r:randomColorVal(), g: randomeColorVal(), b: randomColorVal()};
}
// generate hex string color value like FF4409
function generateRandomColorHex() {
function randomColorVal() {
var val = Math.floor(Math.random() * 256).toString(16);
if (val.length < 2) {
val = "0" + val;
}
return(val);
}
return(randomColorVal() + randomColorVal() + randomColorVal());
}