Math类

alt text

Math.random()返回的是[0,1)的一个随机小数。 取[a,b]之间的一个随机整数可以写

int x = a + (int)(Math.random()*(b-a+1)+a);

本文章使用limfx的vscode插件快速发布