9 Replies Latest reply: Mar 23, 2008 11:29 PM by 807591 RSS

    How to generate random strings

      Gday all,

      So I have to create a simple guessing game where the user guesses a 3 letter string that is randomly generated:

      "For each new game your program will generate three unique random numbers between 0 and 9
      inclusive, and convert them into a String of three characters in the range A to J. This String will be an
      input to a game, where the user tries to guess the correct letters in the correct order. Examples of valid
      input Strings would be, �JAD�, �ABC�, �IBE� and �EFG�. Examples of some invalid input Strings could be
      �abc�, �AAA�, �123�, �AdE� or �NME�."

      Just wondering how to create this random string? I know how to generate a random 3 char number (num = (int) (Math.random() * 1000)) but I dont know how to convert this into a corresponding string, as the instructions say.

      I know this is very basic, but any tips?