Added weighted random generator.