Thanks:  0
Likes:  0
Dislikes:  0

Thread: generate a random 9 digit number

1. generate a random 9 digit number

User (ssylve1445@mindspring.com) posted:

Does anyone have a quick and easy way to generate a 9 digit number randomly? I can get the srand () to work but it does not produce a 9 digit number.

Stephanie
NetJuice Consulting

Tell us what you think! http://us.click.yahoo.com/vO1FAB/txz...SFAA/NhFolB/TM

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

2. Re: generate a random 9 digit number

User Andrew McFarlane (welkin_inc@hotmail.com) posted:

I'm not sure about the randomness of this, but take a look anyway:

#include "as_web.h"

#define MIN 1000000000
Action1()
{

int i;
long int theNumber;

srand(time());

theNumber = rand();

while( theNumber < MIN ) {
theNumber <<= 1;
lr_output_message("theNumber: %ld", theNumber);
}

return 0;
}

Andrew McFarlane
Welkin Consulting, Inc.
----Original Message Follows----
From: ssylve1445@mindspring.com
Subject: [LoadRunner] generate a random 9 digit number
Date: Wed, 01 Aug 2001 13:41:52 -0400

Does anyone have a quick and easy way to generate a 9 digit number randomly?
I can get the srand () to work but it does not produce a 9 digit number.

Stephanie
NetJuice Consulting

__________________________________________________ _______________

Tell us what you think! http://us.click.yahoo.com/vO1FAB/txz...SFAA/NhFolB/TM

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

3. Re: generate a random 9 digit number

User robert stencel (rstencel@hotmail.com) posted:

you can use the random number parameter and change the number format to
%09lu and that forces it to display 9 digits (you can also set the range for
only 9 digit numbers if you like).

__________________________________________________ _______________

Secure your servers with 128-bit SSL encryption! Grab your copy of VeriSign's FREE Guide: "Securing Your Web Site for Business." Get it Now! http://us.click.yahoo.com/n7RbFC/zhw...gFAA/NhFolB/TM

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.