revised generate id function of account class