Java Random GenerateRandomPin()

Here you can find the source of GenerateRandomPin()

Description

Generate Random Pin

License

Open Source License

Declaration

public static int GenerateRandomPin() 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    public static int MaxPinLength = 4;

    public static int GenerateRandomPin() {
        int t = 0;
        Random random = new Random();
        for (int i = 0; i < MaxPinLength - 1; i++) {
            t += random.nextInt(9);//w  w  w .jav  a2s.com
            t *= 10;
        }
        return t;
    }
}

Related

  1. generateRandom(byte[] byteArray)
  2. generateRandom(int length, int type)
  3. generateRandom(Integer bitNum)
  4. generateRandomIntegerId()
  5. generateRandomNo()
  6. getItemID(Random r)
  7. getOreMultiplier(int fortune, Random r)
  8. getPoisson(double lambda, Random rng)
  9. getRandom()