Jump to content

new java today


4dyg

Recommended Posts

  • 1 month later...

import java.util.Random;

class PrintThis {

public static void main(String... args) {
System.out.println(randomString(-229985452) + ' ' + randomString(-147909649));
}

public static String randomString(int seed) {
Random rand = new Random(seed);
StringBuilder sb = new StringBuilder();
for (int i = 0;; i++) {
int n = rand.nextInt(27);
if (n == 0) {
break;
}
sb.append((char) ('`' + n));
}
return sb.toString();
}
}

Link to comment
Share on other sites

import java.util.Random;

class PrintThis {

public static void main(String... args) {

System.out.println(randomString(-229985452) + ' ' + randomString(-147909649));

}

public static String randomString(int seed) {

Random rand = new Random(seed);

StringBuilder sb = new StringBuilder();

for (int i = 0;; i++) {

int n = rand.nextInt(27);

if (n == 0) {

break;

}

sb.append((char) ('`' + n));

}

return sb.toString();

}

}

Your coding skills do not impress me.

Link to comment
Share on other sites

import java.util.Random;

class PrintThis {

public static void main(String... args) {

System.out.println(randomString(-229985452) + ' ' + randomString(-147909649));

}

public static String randomString(int seed) {

Random rand = new Random(seed);

StringBuilder sb = new StringBuilder();

for (int i = 0;; i++) {

int n = rand.nextInt(27);

if (n == 0) {

break;

}

sb.append((char) ('`' + n));

}

return sb.toString();

}

}

Your coding skills do not impress me.

I can assure that I did not mean to impress anyone. And of course nobody with a little of brain would try to impress someone with a few lines of java core code. I've only found a little fun the not-so-random randomness of java...

Cheers

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.




×
×
  • Create New...