a code that draws five random characters

Asked 1 years ago, Updated 1 years ago, 92 views

[a-zA-z0-9] We need a code to randomly pick 5 letters from the set Can you give me a hint?

javascript random

2022-09-22 13:53

1 Answers

function makeid()
{
    var text = "";
    var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

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

    return text;
}

It'll probably work out.


2022-09-22 13:53

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.