Javascript Snippets Color Function

The following piece of code can be used to return a random color, or a random password - just mix in a few extra characters, like ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%&*() into the possible var:

function color(num){
  var text='',possible = "abcdef1234567890";
  for( i=0; i < num; i++ ){
    text += possible.charAt(Math.floor(Math.random() * possible.length));
  return text;

I got this from somewhere on the internet several years ago.