取一定範圍內的隨機數!

//取5到100之間的隨機數

public class Test
{
public static void main(String[] args)
{
int random = 5 + (int)(Math.random()*(100-5+1));
System.out.println(random);
}
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章