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 から 30 までの乱数を作成する必要があります。しかし、同じ乱数は生成されません。生産される数は、それぞれ異なる必要があります。
それは可能ですか?
ありがとう
1 ~ 30 を含む を作成し、List<Integer>を使用してシャッフルしCollections.shuffle()、リストを反復処理します。もちろん、リストの最後に、まだ生成されていない新しい番号を含めることはできません。
List<Integer>
Collections.shuffle()