mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-09 20:20:56 +08:00
Add MinValueTest
and remove main
from MinValue
(#4713)
* Update MinValue.java * Create MinValueTest.java * Revert "Create MinValueTest.java" * Create MinValueTest.java * Update MinValueTest.java * Update MinValueTest.java * Update MinValue.java * Update src/test/java/com/thealgorithms/maths/MinValueTest.java Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com> * Update src/test/java/com/thealgorithms/maths/MinValueTest.java Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com> * Update src/main/java/com/thealgorithms/maths/MinValue.java Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com> --------- Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
This commit is contained in:
@ -1,24 +1,8 @@
|
||||
package com.thealgorithms.maths;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class MinValue {
|
||||
|
||||
/**
|
||||
* Driver Code
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
Random rand = new Random();
|
||||
|
||||
/* test 100 times using rand numbers */
|
||||
for (int i = 1; i <= 100; ++i) {
|
||||
/* generate number from -50 to 49 */
|
||||
int a = rand.nextInt(100) - 50;
|
||||
int b = rand.nextInt(100) - 50;
|
||||
assert min(a, b) == Math.min(a, b);
|
||||
}
|
||||
public final class MinValue {
|
||||
private MinValue() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the smaller of two {@code int} values. That is, the result the
|
||||
* argument closer to the value of {@link Integer#MIN_VALUE}. If the
|
||||
|
Reference in New Issue
Block a user