× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I did get an answer. I was not really looking for a way to generate
random numbers, just to randomize the records. I created a version of
the file with a random number field and then copied the results..

Thanks,

Albert

On Tue, Jun 12, 2012 at 7:49 AM, Bill Meecham
<BMeecham@xxxxxxxxxxxxxxxxxxxx> wrote:

Did you get an answer?

This will create random numbers.

d wrkNumber       s             15  0
 /FREE
  exec sql
   set :wrkNumber =
     rand(digits(MICROSECOND(CURRENT_TIMESTAMP) + day(CURRENT_TIMESTAMP)))
       * 1000000000000000 ;   // because sql rand returns values < 1

   *inlr = *on ;
   Return ;
/end-free


This will create smaller random numbers (not my code, I tested it and it works though)
 http://www.mysamplecode.com/2011/06/rpgle-generate-random-number-use-rand.html






-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Albert York
Sent: Tuesday, June 05, 2012 1:33 PM
To: RPG programming on the IBM i / System i
Subject: Re: Randomizing records in a file

I'm sorry. I can't get too detailed as there are confidentiality issues.

On Tue, Jun 5, 2012 at 10:17 AM, John Yeung <gallium.arsenide@xxxxxxxxx> wrote:
On Mon, Jun 4, 2012 at 8:18 PM, Albert York <alfromme@xxxxxxxxx> wrote:
In my case I have a list of letter sequences that I need to replace
with a randomly selected sequence.

This is remarkably unenlightening.  It amounts to

Q:  Why do you need to generate random numbers?

A:  Because I need random numbers.

You certainly have no obligation to provide a meaningful description
of your use case, especially since your immediate technical question
was already answered and I stated upfront I was just being nosy.  But
you might as well not have responded at all.

John
--

--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.