Hi All,
I have to produce random no as customer id for near about 60 mil customer records. The logic to generate the random no needs to be the following:
randomID = Double(floor(random() * 1000))
timeID = Long(currentTimeMillis())
Gen_ID = randomID (concatination) timeID
if (Length(Gen_ID) < 18 ) then
{
CUS_ID = Gen_ID
}
else
{
while (length(Gen_ID) < 18)
{
randomID = Double(floor(random() * 1000))
timeID = Long(currentTimeMillis())
CUS_ID = randomID (concatination) timeID
}
Friends it would be really a great help if some body can give me the way to generate this.
Thanks,
Bireswar
Generation of Ramdom Number
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 33
- Joined: Wed Sep 03, 2008 5:48 am
- Location: Bangalore
Re: Generation of Ramdom Number
[quote="bireswar.goswami"]Hi All,
I have to produce random no as customer id
Why you want to generate random number, to maintain Cust_Id to be unique or there is some other purpose ?
I have to produce random no as customer id
Why you want to generate random number, to maintain Cust_Id to be unique or there is some other purpose ?
I wish I had DS on this machine, at least the documentaton; the function is either "RND()" or "RAND()" but I can't recall which. You can also SEED the series to ensure that you get reproduceable results. As asked before, if you wish to get unique customer IDs then using a random number generator is not the way to go as you will, at some point in time, get duplications.
You can either use a sequence (either from DataStage or from a database) or, if you wish pseudo-random customer numbers, at least keep a list of numbers used in a hashed file so you can avoid duplicates.
You can either use a sequence (either from DataStage or from a database) or, if you wish pseudo-random customer numbers, at least keep a list of numbers used in a hashed file so you can avoid duplicates.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>