updated with proper assign;
added randomization