implemented simple setcount
small changes, random generator