So first part of code is variable definition, coming to the second part in function genrate firstly i have set some default values to variables, such as min Limit, Boolean Repeated etc. coming to the third part, it is a small logic which anyone can understand, I have taken an Array and checked conditions for repeatation and multiple for which i have over written array elements.
Sample code which should be written in FLA is also provided with class.
Note The class file should be Kept in same directory as FLA.