gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [open-cobol-list] How to use RANDOM function.


From: John Culleton
Subject: Re: [open-cobol-list] How to use RANDOM function.
Date: Wed, 10 Nov 2010 17:25:41 -0500
User-agent: KMail/1.11.4 (Linux/2.6.29.6-smp; KDE/4.2.4; i686; ; )

On Wednesday 10 November 2010 16:59:54 you wrote:
> Hi John,
>
> the unix/c "random" function has been designed to work this way.
> usually people are seeding it with a time() - which are the
> seconds... :-)
>
> Regards,
> SK
>
> ----- Original Message -----
> From: "John Culleton" <address@hidden>
> To: <address@hidden>
> Sent: Wednesday, November 10, 2010 4:50 PM
> Subject: [open-cobol-list] How to use RANDOM function.
>
> >I want to have a certain number randomly chosen every time a
> > certain program runs.
> >
> > I have this in WORKING-STORAGE:
> >        77  RANDUM PICTURE S9V9(10).
> > I have this statement:
> > COMPUTE RANDUM = FUNCTION RANDOM(0).
> > Every time I run the program the value of RANDUM is the same. If
> > I change the seed then I get a different number but that is
> > repetitious also. If I leave off the seed it acts as if the seed
> > was zero. --
> > John Culleton, Wexford Press
> >
> >
> > -----------------------------------------------------------------
> >------------- The Next 800 Companies to Lead America's Growth: New
> > Video Whitepaper David G. Thomson, author of the best-selling
> > book "Blueprint to a Billion" shares his insights and actions to
> > help propel your business during the next growth cycle. Listen
> > Now!
> > http://p.sf.net/sfu/SAP-dev2dev
> > _______________________________________________
> > open-cobol-list mailing list
> > address@hidden
> > https://lists.sourceforge.net/lists/listinfo/open-cobol-list

Thanks. With that in mind I may as well just use the seconds and 
forget the function. It only normalizes the number in the range of 0.0 
to 1.0.

John Culleton, Wexford Press
"Create Book Covers with Scribus" $5.95 at
http://www.booklocker.com/books/4055.html

Free eps format barcode: http://www.tux.org/~milgram/bookland/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]