random generator fix-somewhat