Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java generate random id

String id = UUID.randomUUID().toString();
Comment

how to generate random id in java

import java.util.UUID;
public class UUIDExample.
{
public static void main(String[] args)
{
UUID uuid=UUID.randomUUID(); //Generates random UUID.
System.out.println(uuid);
}
}
Comment

Java random number generator

Random random = new Random();
long v1 = random.nextInt();
long v2 = random.nextInt();
for (int i = 0; i < 65536; i++) {
    long seed = v1 * 65536 + i;
    if (((seed * multiplier + addend) & mask) >>> 16) == v2) {
        System.out.println("Seed found: " + seed);
        break;
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: java random unique key 
Java :: euclids algoritm java gcd 
Java :: hashmap foreach 
Java :: java loop hashmap 
Java :: imageio class java 
Java :: arrays sort 2d array java 
Java :: why java platform independent 
Java :: android date 
Java :: main methode java 
Java :: change button text java 
Java :: byte array to base64 string 
Java :: java example 
Java :: valueof vs tostring 
Java :: java get folder content 
Java :: change number into array in java 
Java :: Cannot invoke toString() on the primitive type int 
Java :: what is use of static block in java 
Java :: hide elements android 
Java :: how to print hello world java 
Java :: Java, how to compare Strings with String Arrays 
Java :: flow dependency android 
Java :: for loop java 
Java :: play mp3 android java 
Java :: java return tuple 
Java :: how to check if string is double or not in java 
Java :: square root of a number in java without sqrt 
Java :: graph contains a cycle 
Java :: java big integer to int 
Java :: list files in directory java 
Java :: build.plugins.plugin.version 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =