modified randomized soln code, plus validator; need to fix endless loops...