weighted number generator final version