js code for random cubes