Java tutorial
//package com.java2s; /* Copyright (c) 2015-2016 Microsoft Corporation. This software is licensed under the MIT License. * See the license file delivered with this project for further information. */ import java.util.Date; import java.util.Random; public class Main { private static Random mRandom = null; /** * Generates a random byte and returns it as a hexadecimal string. * * @return A random byte as hexadecimal string. */ public static String generatedRandomByteAsHexString() { if (mRandom == null) { mRandom = new Random(new Date().getTime()); } int randomInt8 = mRandom.nextInt(256); return Integer.toHexString(randomInt8); } }