Skip to content

Commit

Permalink
Merge pull request #2008 from Space9999/Space9999-patch-1
Browse files Browse the repository at this point in the history
Added a random value generator
  • Loading branch information
fineanmol committed Oct 3, 2022
2 parents 6dd6d79 + bc9786e commit da00140
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions js/GeneratesRandomValue.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import java.util.*;

// Generates a random value and prints it
public class GeneratesRandomValue {
public static void main(String[] args) {
Random random = new Random();
int number1 = random.nextInt(100000);
int randomnumber = encryption(number1);
System.out.println(randomnumber);
}
public static int encryption(int num) {
Random random = new Random();
int x = random.nextInt(10057003);
int y = random.nextInt(10037262);
if (num % 2 == 0) {
num /= 8;
num = num + num * (x / 2);
}
else {
num /= 86;
num = num + num * (y / 5);
}
return num;
}
}

0 comments on commit da00140

Please sign in to comment.