Adam already covered the sensible solution. I'll post my own.
MIMT randspots() generates an image containing random colored shapes:
A = randspots([800 1000 3],200,[20 60],[0.1 0.8],'rectangle');
I've been meaning to rewrite it, but I haven't bothered yet. The syntax is clumsy, but it works.
randspots() is from the MIMT on the File Exchange.
If neither of these solutions are what you're after, then you'll need to be more specific.
Ah. I guess if you're working from a color table, then randspots doesn't apply. As the name implies, all it can do is random.