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.
是否可以从数字列表或预定义集合中生成随机整数 - 这可能不按顺序排列。
例如 - 从 1,2,4,5 生成一个随机数(不允许 3)。
您可以创建一个包含所有预定义集合的数组,然后使用从 0 到数组长度的随机数填充整数索引。这应该够了吧 :)