Java examples for java.lang:String Random
generate Random Id via UUID
//package com.java2s; import java.util.*; public class Main { public static void main(String[] argv) { boolean removeDashes = true; System.out.println(generateRandomId(removeDashes)); }//from w w w. j ava2 s. c om public static String generateRandomId(boolean removeDashes) { String uuid = UUID.randomUUID().toString(); if (removeDashes) { uuid = uuid.replace("-", ""); } return uuid; } }