Skip to content
Open
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
6 changes: 4 additions & 2 deletions lab2.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ public static void main(String[] args) {
double[] randomArray = new double[arrayLength];

// Генерація псевдовипадкових чисел з рівномірним розподілом
Random random = new Random();
// ефективніший ніж звичайний Random у 5 разів
java.util.concurrent.ThreadLocalRandom random = java.util.concurrent.ThreadLocalRandom.current();

Copy link
Author

Choose a reason for hiding this comment

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

Тут не надто багато елементів у масиві, тому це не є вкрай необхідно

for (int i = 0; i < arrayLength; i++) {
randomArray[i] = random.nextDouble(); // генерує числа від 0 до 1
}
Expand All @@ -35,4 +37,4 @@ public static void main(String[] args) {
System.out.println("Мінімальне значення: " + min);
System.out.println("Максимальне значення: " + max);
}
}
}