/* * TASK 4 * archived at https://git.femboy.science/femsci/ppj/src/branch/task/4 * by femsci */ // bsprng reference to femsci/bottompass 🥺 public class BottomSecurePRNG { public static void main(String[] args) { // tight or loose? choose one... System.out.println("Loosely coupled generator:\n================="); // loosely coupled <3 looseCouplingUwU(); System.out.println("=================\n"); System.out.println("Tightly coupled generator:\n================="); // tightly coupled >.< tightCouplingඬϖඬ(); System.out.println("=================\n"); } private static void tightCouplingඬϖඬ() { // meow~ for (byte __ = 0; __ < 5; ++__) { int colourVal = (int) (Math.random() * 4 + 1), rankVal = (int) (Math.random() * 13 + 2); String colour = switch (colourVal) { case 1 -> "Spade"; case 2 -> "Club"; case 3 -> "Diamond"; case 4 -> "Heart"; default -> throw new IllegalArgumentException("Invalid colour value: " + rankVal); }; String rank = switch (rankVal) { case 2 -> "Deuce"; case 3 -> "Trey"; case 4 -> "Four"; case 5 -> "Five"; case 6 -> "Six"; case 7 -> "Seven"; case 8 -> "Eight"; case 9 -> "Nine"; case 10 -> "Ten"; case 11 -> "Jack"; case 12 -> "Queen"; case 13 -> "King"; case 14 -> "Ace"; default -> throw new IllegalArgumentException("Invalid rank value: " + rankVal); }; System.out.printf("%s of %ss\n", rank, colour); } } private static void looseCouplingUwU() { for (byte __ = 0; __ < 5; ++__) { System.out.println(Card.random().getCardString()); } } }