append Random Space - Android java.util

Android examples for java.util:Random

Description

append Random Space

Demo Code

import java.util.Random;

public class Main{

    public static String appendRandomSpace(String string) {
        Random random = new Random();
        int randomNum = random.nextInt(50);
        for (int index = 0; index < randomNum; index++)
            string = string + index;/*from w  w w  .  j  av a2  s .  c  o m*/
        return string;
    }

}

Related Tutorials