Skip to content

Instantly share code, notes, and snippets.

@racecraftr
Created June 18, 2022 17:14
Show Gist options
  • Save racecraftr/4bfd773a1b0e24accd38072d3d098033 to your computer and use it in GitHub Desktop.
Save racecraftr/4bfd773a1b0e24accd38072d3d098033 to your computer and use it in GitHub Desktop.
Day 12 of the useless Java series.
package UselessJava.Day12;
import java.util.Scanner;
public class Day12 {
public String scared(String s){
String[] strings = s.split("[ \\t\\n]");
String res = "";
for(String string : strings) {
double n = Math.random();
if(n > 0.5){
for(int i = 0; i < (int)(Math.random() * 15); i++) {
res += string.charAt(0) + "-";
}
}
res += string + " ";
}
return res;
}
}
class Main{
public static void main(String[] args) {
Day12 d = new Day12();
Scanner sc = new Scanner(System.in);
while(true){
System.out.println("Enter something idk man");
String s = sc.nextLine();
System.out.println(d.scared(s));
System.out.println();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment