Generate random lowercase letter

In this example we will generate random lowercase letter by using ASCII representation of lowercase letter. The ASCII range for lowercase letters is between 97 and 126 so we can generate a random number within a range then convert the converting ASCII char to a string. We will output the lower case letter by using a java 8 foreach loop.

Java 8

public void random_lowercase_java8() {

    Random random = new Random();
    random.ints(97, 126).limit(10)
            .forEach(a -> System.out.println(Character.toString((char) a)));