added random init function