title: Generate random String in Java without using random class or method directly for string
body: <p>I am trying to write down the code to generate the random string of 5 characters from a predefined string.</p>
  
  <p>My goal is to create a String array of length 5, and store all 5 random strings in this array.</p>
  
  <p>So, far I have written below code:</p>
  
  <pre><code>public static String generateRandomString(int stringlength, String fullstring){
          //Generating random number which will use to pick character from provider string at index[i]
          int i =((int)(Math.random()*100));
  
          //Created a character array to store the characters picked up from provided String
          char [] randomString = new char[5];
  
          //Checking the condition if generated random number is greater than or equals to string length to avoid OutOfBoundException
          if (i&gt;=stringlength){
              generateRandomString(stringlength, fullstring);
          }
          //Else Fetching the character from provided string and storing it into Char[]
          else
          {
  
                  randomString [0] = (fullstring.charAt(i));
                  randomString [1] = (fullstring.charAt(i));
                  randomString [2] = (fullstring.charAt(i));
                  randomString [3] = (fullstring.charAt(i));
                  randomString [4] = (fullstring.charAt(i));
          }
          //Converting Char[] to String.
          String returnString = new String(randomString);
  
          //Returning String
          return returnString;
  
      }
  
      public static void main(String[] args) {
          // TODO Auto-generated method stub
  
          //String Array to Store Random Strings
          String [] array = new String[5];
  
          //Provided String
          String fullstring = "abcdefghijklmnopqrstuvwxyz";
          int stringlength = fullstring.length();
  
          //Loop to store random strings into all indexes of String[]
          for(int j=0;j&lt;5;j++){
  
          array[j]=generateRandomString(stringlength, fullstring);
          }
  
          //Printing Final String[]
          for(String var:array){
              System.out.println(var);
          }
  
      }
  </code></pre>
  
  <p><strong>But I am facing two issues:</strong></p>
  
  <ol>
  <li>I want my random string to not contain only single character, my current code is picking only one character for all 5 places. Because it is taking one value (i). I want to change my value of (i) to again any random value after every character stored for one index at char[].</li>
  </ol>
  
  <p><strong>e.g.</strong></p>
  
  <p>I am getting "aaaaa" for one random string but I want like "auzje"</p>
  
  <ol start="2">
  <li>When I am printing the Final String[], sometimes I am getting NULL string in my output.</li>
  </ol>
  
  <p><strong>e.g.</strong> 
  "     "</p>
  
  <p>"aaaaa"</p>
  
  <p>"     "</p>
  
  <p>"ggggg"</p>
  
  <p>"iiiii"</p>
  
  <p><strong>What I am finally looking for is:</strong></p>
  
  <p>"ajsuh"</p>
  
  <p>"ldugj"</p>
  
  <p>"odueb"</p>
  
  <p>"mcnde"</p>
  
  <p>"yahnf"</p>
  
  <p>Please suggest.</p>
  
  <p>Many Thanks.</p>