Add init func

Add ```init``` function and move globals initialization and calls of ```runtime.GOMAXPROCS``` and ```rand.Seed``` in it.