get Random Id Bytes - Android java.util

Android examples for java.util:Random

Description

get Random Id Bytes

Demo Code


//package com.java2s;

import java.util.Random;

public class Main {
    private static byte[] getRandomIdBytes() {
        Random rand = new Random(System.currentTimeMillis());
        byte buf[] = new byte[4];
        rand.nextBytes(buf);//w ww . j  a v  a 2  s. c  o m
        return buf;
    }
}

Related Tutorials