diff --git a/Randomized/pom.xml b/Randomized/pom.xml
new file mode 100644
index 000000000000..ed0c84275113
--- /dev/null
+++ b/Randomized/pom.xml
@@ -0,0 +1,32 @@
+
+ 4.0.0
+ br.com.exemplo
+ meu-projeto
+ 1.0-SNAPSHOT
+
+
+ 1.8
+ 1.8
+
+
+
+
+ org.junit.jupiter
+ junit-jupiter
+ 5.10.2
+ test
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 3.2.5
+
+
+
+
diff --git a/Randomized/src/main/java/learningspace/swtest/examples/ClosestPairRandomized.java b/Randomized/src/main/java/learningspace/swtest/examples/ClosestPairRandomized.java
new file mode 100644
index 000000000000..d1b6f80b530a
--- /dev/null
+++ b/Randomized/src/main/java/learningspace/swtest/examples/ClosestPairRandomized.java
@@ -0,0 +1,37 @@
+package learningspace.swtest.examples;
+
+import java.util.*;
+
+public class ClosestPairRandomized {
+
+ public static class Point {
+ double x, y;
+ public Point(double x, double y) {
+ this.x = x;
+ this.y = y;
+ }
+ }
+
+ public static double distance(Point a, Point b) {
+ return Math.hypot(a.x - b.x, a.y - b.y);
+ }
+
+ public static double closestPair(Point[] points, int samples) {
+ Random rand = new Random();
+ List shuffled = new ArrayList<>(Arrays.asList(points));
+ Collections.shuffle(shuffled, rand);
+
+ double minDist = Double.MAX_VALUE;
+ for (int i = 0; i < samples; i++) {
+ Point p1 = shuffled.get(rand.nextInt(shuffled.size()));
+ Point p2 = shuffled.get(rand.nextInt(shuffled.size()));
+ if (p1 != p2) {
+ double d = distance(p1, p2);
+ if (d < minDist) {
+ minDist = d;
+ }
+ }
+ }
+ return minDist;
+ }
+}
diff --git a/Randomized/src/test/java/learningspace/swtest/examples/ClosestPairRandomizedTest.java b/Randomized/src/test/java/learningspace/swtest/examples/ClosestPairRandomizedTest.java
new file mode 100644
index 000000000000..e51a265189e2
--- /dev/null
+++ b/Randomized/src/test/java/learningspace/swtest/examples/ClosestPairRandomizedTest.java
@@ -0,0 +1,34 @@
+package learningspace.swtest.examples;
+
+
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
+
+public class ClosestPairRandomizedTest {
+
+ @Test
+ public void testRandomizedClosestPair() {
+ ClosestPairRandomized.Point[] points = {
+ new ClosestPairRandomized.Point(0, 0),
+ new ClosestPairRandomized.Point(3, 4),
+ new ClosestPairRandomized.Point(1, 1),
+ new ClosestPairRandomized.Point(2, 2)
+ };
+
+ double result = ClosestPairRandomized.closestPair(points, 10000);
+ double expectedMinDist = Math.sqrt(2); // Entre (1,1) e (2,2)
+ assertTrue(result <= expectedMinDist + 0.5, "Distância deve ser próxima ou menor que esperado");
+ }
+
+ @Test
+ public void testWithIdenticalPoints() {
+ ClosestPairRandomized.Point[] points = {
+ new ClosestPairRandomized.Point(1, 1),
+ new ClosestPairRandomized.Point(1, 1),
+ new ClosestPairRandomized.Point(2, 2)
+ };
+
+ double result = ClosestPairRandomized.closestPair(points, 1000);
+ assertEquals(0.0, result, 0.001);
+ }
+}
diff --git a/Randomized/target/classes/learningspace/swtest/examples/ClosestPairRandomized$Point.class b/Randomized/target/classes/learningspace/swtest/examples/ClosestPairRandomized$Point.class
new file mode 100644
index 000000000000..1c2aa51455f2
Binary files /dev/null and b/Randomized/target/classes/learningspace/swtest/examples/ClosestPairRandomized$Point.class differ
diff --git a/Randomized/target/classes/learningspace/swtest/examples/ClosestPairRandomized.class b/Randomized/target/classes/learningspace/swtest/examples/ClosestPairRandomized.class
new file mode 100644
index 000000000000..b9716a5300fe
Binary files /dev/null and b/Randomized/target/classes/learningspace/swtest/examples/ClosestPairRandomized.class differ
diff --git a/Randomized/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/Randomized/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
new file mode 100644
index 000000000000..49545dde3538
--- /dev/null
+++ b/Randomized/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
@@ -0,0 +1,2 @@
+learningspace\swtest\examples\ClosestPairRandomized.class
+learningspace\swtest\examples\ClosestPairRandomized$Point.class
diff --git a/Randomized/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/Randomized/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
new file mode 100644
index 000000000000..7cd48bf3e5d1
--- /dev/null
+++ b/Randomized/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
@@ -0,0 +1 @@
+C:\Users\anell\Downloads\trabalho\Guess the number\src\main\java\learningspace\swtest\examples\ClosestPairRandomized.java
diff --git a/Randomized/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/Randomized/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
new file mode 100644
index 000000000000..fe8fef47336c
--- /dev/null
+++ b/Randomized/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
@@ -0,0 +1 @@
+learningspace\swtest\examples\ClosestPairRandomizedTest.class
diff --git a/Randomized/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/Randomized/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
new file mode 100644
index 000000000000..2de3b5fa266a
--- /dev/null
+++ b/Randomized/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
@@ -0,0 +1 @@
+C:\Users\anell\Downloads\trabalho\Guess the number\src\test\java\learningspace\swtest\examples\ClosestPairRandomizedTest.java
diff --git a/Randomized/target/surefire-reports/TEST-learningspace.swtest.examples.ClosestPairRandomizedTest.xml b/Randomized/target/surefire-reports/TEST-learningspace.swtest.examples.ClosestPairRandomizedTest.xml
new file mode 100644
index 000000000000..68d129d81711
--- /dev/null
+++ b/Randomized/target/surefire-reports/TEST-learningspace.swtest.examples.ClosestPairRandomizedTest.xml
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Randomized/target/surefire-reports/learningspace.swtest.examples.ClosestPairRandomizedTest.txt b/Randomized/target/surefire-reports/learningspace.swtest.examples.ClosestPairRandomizedTest.txt
new file mode 100644
index 000000000000..73903dfd9b83
--- /dev/null
+++ b/Randomized/target/surefire-reports/learningspace.swtest.examples.ClosestPairRandomizedTest.txt
@@ -0,0 +1,4 @@
+-------------------------------------------------------------------------------
+Test set: learningspace.swtest.examples.ClosestPairRandomizedTest
+-------------------------------------------------------------------------------
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.074 s -- in learningspace.swtest.examples.ClosestPairRandomizedTest
diff --git a/Randomized/target/test-classes/learningspace/swtest/examples/ClosestPairRandomizedTest.class b/Randomized/target/test-classes/learningspace/swtest/examples/ClosestPairRandomizedTest.class
new file mode 100644
index 000000000000..7a150a3a4ae2
Binary files /dev/null and b/Randomized/target/test-classes/learningspace/swtest/examples/ClosestPairRandomizedTest.class differ