Hi everyone,
I used random function in transformer to generate random numbers and after that I am sorting them in ascending order so that the particular rows linked to a particular random number will not be pulled same each time. i.e my requirement is each time I need to get different records to be pulled.
But for some reason the random numbers generated are same all the times, I mean the numbers are random but everytime I run the job generates the same numbers which are generated for the first time.
Suggest me what change do I need to do to change the numbers different each time I run the job.
Thank you!
Random Function
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 248
- Joined: Fri Jul 30, 2010 9:04 am
Random Function
Regards,
Kenny
Kenny
Unfortunately, the parallel transformer doesn't provide an interface to the underlying randomizer seed functions srand() or srandom(). Use a column generator to create your random value and provide an integer seed value from a job parameter (you can create a timestamp-based one in a job sequence so that it is a different value each time you run the job).
Regards,
Regards,
- james wiles
All generalizations are false, including this one - Mark Twain.
All generalizations are false, including this one - Mark Twain.
So, as you've seen, those random numbers are not truly random since the pattern repeats each time based on the "seed" or the intial starting value. I believe the term is 'psuedo-random', hang on.... yup: Pseudorandom Number Generator wiki entry.
As noted though, you have ways to "randomly" set the seed value each time the job runs so your values become more random-esque.
As noted though, you have ways to "randomly" set the seed value each time the job runs so your values become more random-esque.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: