Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.
Scripting - random 11 digit number
LegacyForum
Posts: 1,664 ✭✭
Comments
-
Hi LeapTester,
Here is the script for generating random 11 digit sequences.CODEfrom java.util import *
def myRandom():
rand = Random();
# Make sure first digit is not zero
ret = str(rand.nextInt(9) + 1);
index = 0;
while index < 10:
ret = ret + str(rand.nextInt(10));
index = index + 1;
return ret
I assumed that the first digit cannot be zero. If that is the wrong assumption, please change the while loop to run 11 times instead of 10 and change
CODEret = str(rand.nextInt(9) + 1);
to
ret = '' # 2 single quotes0