You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test2.js 471 B

123456789101112131415161718192021
  1. const GenId = require('..')
  2. function test1() {
  3. const genid = new GenId({ WorkerId: 1 })
  4. for (let index = 0; index < 5000; index++) {
  5. console.log(genid.NextId());
  6. }
  7. }
  8. function test2() {
  9. const genid = new GenId({ WorkerId: 1, SeqBitLength: 14 })
  10. for (let i = 0; i < 10; i++) {
  11. let id1 = genid.NextId()
  12. console.log(`${i} ID:${id1} ${typeof id1} 长度:${id1.toString().length}`)
  13. }
  14. }
  15. function main() {
  16. test2()
  17. }
  18. main()