Vietnam

    Nodejs.vn

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Tags
    • Groups
    • Search

    Cách tạo dãy số ngẫu nhiên trong nodejs để sinh id

    ExpressJS/Conect.IO
    0
    5
    1148
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Khôi Nguyên
      Khôi Nguyên last edited by

      Mọi người cho mình hỏi trong C# có hàm Guild.ToString() vậy trong nodejs có hàm nào hay thư viện nào tương tự để sinh một dãy ngẫu nhiên không ạ. Mình cảm ơn .

      1 Reply Last reply Reply Quote 0
      • H
        Hải Nguyễn215 last edited by

        tùy biến 1 chút là được
        https://stackoverflow.com/questions/1349404/generate-random-string-characters-in-javascript

        1 Reply Last reply Reply Quote 0
        • H
          hoocat Espresso last edited by

          bạn có thể tham khảo: https://github.com/kelektiv/node-uuid

          1 Reply Last reply Reply Quote 1
          • Vũ
            Vũ Global Moderator last edited by

            Mình thường dùng uuid/v4.

            const uuidv4 = require('uuid/v4');
            uuidv4(); // ⇨ '45db52e1-f95c-4b5f-99a2-8b8d978c99b4'
            

            Cách cài đặt bạn follow theo link hướng dẫn của @hoocat nhé

            bạn có thể tham khảo: https://github.com/kelektiv/node-uuid

            Tech-nông
            Email: [email protected]
            Profile: about.me/vunb
            Github: github.com/vunb
            Twitter: twitter.com/nhubaovu

            1 Reply Last reply Reply Quote 0
            • Khôi Nguyên
              Khôi Nguyên last edited by

              Mình cảm ơn mọi người

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              $(document).ready(function () { app.coldLoad(); }); }