move the random part to main()