Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

랜덤 데이터 생성 #4

Merged
merged 1 commit into from
Oct 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/git_test4/Main.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
package git_test4;

import java.util.Arrays;
import java.util.Random;

public class Main {

static int[] createArray(int size, int minValue, int maxValue) {
Random random = new Random();
int[] a = new int[size];
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mosesyumss 이거 뭔가요?

for (int i = 0; i < a.length; ++i)
a[i] = random.nextInt(maxValue - minValue + 1) + 1;
return a;
}

public static void main(String[] args) {
int[] a = { 4, 8, 2, 6, 10, 3, 1, 7, 9, 5 };
int[] a = createArray(10, 1, 10);
Sort.sort(a);
System.out.println(Arrays.toString(a));
}
Expand Down