Diverge spectral type of randomly generated Stars

Also reduced redundant codes in init.nut by introducing a local function.