Why do I use snowflake to generate duplicate id

problem description

for (int i = 0; I < 1000; iPP) {

    //idworker    id
    IdWorker idWorker = new IdWorker(new Random().nextInt(30), 0);
    ....

}

Apr.26,2021

new Random (). NextInt (30) the return value should be 0 to 30.


IdWorker is put inside = =. These two parameters are used in distributed, with a maximum of 961 sets of 31 / 31.
there is only one instance of random IdWorker in a project, and
Random should only use one in the method.
"that is, the seed is used to initialize the value of the random number generator, which always produces the same sequence of random numbers for a specific seed value. General Random random = new Random (); system takes the current time milliseconds as the seed number to achieve random, otherwise write the seed number random number is a fixed value "
-- https://blog.csdn.net/xjk201/.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e47992-4cfe5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e47992-4cfe5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?