package com.fuyuanshen.global.mqtt.utils;

import java.util.Random;
import java.util.UUID;

public class GenerateIdUtil {
    /**
     * 生成数字唯一ID - 基于UUID
     */
    public static String generateNumericId() {
        UUID uuid = UUID.randomUUID();
        return Math.abs(uuid.toString().hashCode()) + "";
    }

    /**
     * 生成数字唯一ID - 基于时间戳+随机数
     */
    public static long generateTimestampBasedId() {
        long timestamp = System.currentTimeMillis();
        int random = new Random().nextInt(1000); // 0-999随机数
        return timestamp * 1000 + random;
    }

}
