Skip to content

Commit

Permalink
Merge pull request #4 from Moses-Yu/random_data
Browse files Browse the repository at this point in the history
랜덤 데이터 생성
  • Loading branch information
Moses-Yu authored Oct 14, 2021
2 parents cbdc74b + ea8f130 commit 26151b3
Showing 1 changed file with 10 additions and 1 deletion.
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];
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

0 comments on commit 26151b3

Please sign in to comment.