Randomize in Java script (chrome extension)

Degen

Elite Member
Joined
Apr 9, 2016
Messages
2,604
Reaction score
2,899
Code:
 var url = 'https://www.site.com/api/register/' + user;
            //var data = 'op=reg&user=' + encodeURIComponent(user) + '&passwd=' + encodeURIComponent(pass) + '&passwd2=' + encodeURIComponent(pass) + '&email=&api_type=json';
            var data = 'op=reg&dest=https://www.site.com/&user=' + encodeURIComponent(user) + '&passwd=' + encodeURIComponent(pass) + '&passwd2=' + encodeURIComponent(pass) + '&[email protected]&g-recaptcha-response=' + grecaptchares + '&api_type=json';
            var req = new XMLHttpRequest();
            req.onreadystatechange = function ()
&[email protected]
I want to randomize the email so everything created don't get sent to the same emailadress as verification.

Would Math.random(); work ?

or can I just remove the email variable all together as it is not really required?
 
load all your emails in an array, then call each one with a random generated key.

Code:
function getRandomInt(max) {
  return Math.floor(Math.random() * Math.floor(max));
}

Damn, how vanilla JS feels icky..
 
Back
Top