Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.util.Random;

public class Main {
    static String generateHoodieId() {
        int hoodieIDLength = 7;
        String alphabet = "0123456789abcdefghijklmnopqrstuvwxyz";
        int alphabetLength = alphabet.length();

        String result = "";

        Random rnd = new Random();

        for (int i = 0; i < hoodieIDLength; i++) {
            int r = rnd.nextInt(alphabetLength);
            char c = alphabet.charAt(r);

            result += c;
        }

        return result;
    }
}