Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有 ZShape 并在 Canvas 上绘制它。现在我想在 Zshape 中随机添加不同的形状(矩形、圆形等)。我需要随机函数,它给我在路径中的随机位置,而不重叠已经绘制的(矩形、圆形等)任何帮助将不胜感激。
如果您正在寻找随机号码。然后生成你可以使用这样的东西: -
Random random=new Random(); int randomNo=random.nextInt(4); switch (number) { case 0: //Work for your ractangle break; case 1: //work for your circle break; case 2: //..... break; case 3: //.... break; } }