Is there a difference between:
Random gen = new Random(); //цикл {massive[i]=gen.nextInt(1000);} and
//цикл massive[i]=(int)(Math.random()*1000); ? And when is it better to use? I understand that because of the cast, the second method will be noticeably slower.