Random Name - Node.js Number

Node.js examples for Number:Random Number

Description

Random Name

Demo Code

this.randomName = function () {
    var text = "";
    var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

    for (var i = 0; i < 5; i++)
        text += possible.charAt(Math.floor(Math.random() * possible.length));

    return text;/*from  w  w  w  .j a  v  a2  s . co m*/
};

Related Tutorials