Skip to content

Instantly share code, notes, and snippets.

@SlayterDev
Last active August 29, 2015 14:03
Show Gist options
  • Save SlayterDev/a44d8ea3787543eaf56f to your computer and use it in GitHub Desktop.
Save SlayterDev/a44d8ea3787543eaf56f to your computer and use it in GitHub Desktop.
Create a picture
import java.util.Random;
public class TestBed {
public static void main(String[] args) {
// TODO Auto-generated method stub
char[] tokens = {'o', '+', '-', '#'}; // symobols
Random random = new Random();
System.out.println("---------------"); // top image border
for (int i = 0; i < 10; i++) {
System.out.print('|'); // left border
for (int j = 0; j < 13; j++) {
boolean put = random.nextBoolean();
if (put) { // place a symbol
int choice = random.nextInt(tokens.length);
System.out.print(tokens[choice]);
} else { // place a space
System.out.print(' ');
}
}
System.out.println("|"); // right border
}
System.out.println("---------------"); // bottom image border
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment