Fixed assigning of the generated number