kernel to generate random numbers finished