Manuel,
I got the exact same results and I agree that the RANDOM function could be
created a bit smarter.
set var vcounter int = 0
out test.txt
while vcounter < 10 the
set var vtest = (random(1000))
sho var vtest
set var vcounter = (vcounter + 1)
endw
out scree
Results first run:
513
175
308
534
947
171
702
226
494
124
Results second run
513
175
308
534
947
171
702
226
494
124
Exactly the same.
----- Original Message -----
From: Manuel de Aguiar <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 23, 2001 8:19 PM
Subject: Re: Randomly generated unique numbers - Razzak's Reply
> Hello Jouke,
>
> Did you get the same result as I did on your computer when you type:
> set var vrand = (random(1000))
> and repeating this process?
> I performed this test on a W98 and a W95 computer with identical results.
It
> could be that It only happens on the two test computers I used and that is
why
> RDCC would check this issue.
>
> The whole purpose of having a function that generates a random number is
so that
> you do not have to go through convolutions to get a random number. The
> technique of using a date or time component to change the seed value of
the
> random number generator is something that the programmer of the random
function
> should have used so that when anyone using the random number generator
function
> would correctly generate a random number.
> If you create a random number function that generate predictable numbers,
it is
> NOT a random number generator function. The test I performed repeated the
> numbers EXACTLY every time you enter RBase.
> For a user to have to add a seed value to a supposedly random number
generator
> function is at best a workaround for a defective function.
> Manuel
>
> Jouke Hendrik de Vries wrote:
>
> > Why is this seen as a BUG?
> > There is not a single product on the market who remembers earlier values
> > after the database has been closed and connected again.
> > The only possible way is to load every obtained value in a table (single
> > column) that does not accept duplicates.
> > (RANDOM(1000)) continues until a value is accepted
> >
> > SET ERR VAR verr
> > WHILE #date IS NOT NULL THEN
> > SET VAR vtest = (RANDOM(1000)
> > LOAD RANDOMTAB
> > .vtest
> > END
> > IF verr = 0 THE
> > BREAK
> > ENDI
> > ENDW
> >
> > Another method is to use RANDOM in conjunction with values extracted
from
> > DATE and TIME variables, but even then you cannot quarantee a unique
result.
> >
> > Jouke
> >
> > ----- Original Message -----
> > From: Manuel de Aguiar <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, April 23, 2001 6:51 PM
> > Subject: Re: Randomly generated unique numbers - Razzak's Reply
> >
> > > Hello Rich,
> > > I think you just found a bug.
> > > Using RBase for Windows V6.5++ Build: 1.840gxRT03 I tried your command
> > line
> > > verbatim seven time and got the following number:
> > > 10
> > > 3
> > > 335
> > > 33
> > > 355
> > > 217
> > > 536
> > > I then exit RBase, open RBase again SIX TIMES and got the same
numbers.
> > Since
> > > you discover it, please report it to RDCC so that the Dream Team can
> > correct
> > > this problem.
> > > Thank you,
> > > Manuel de Aguiar
> > > M|D Enterprises
> > >
> > > rich wrote:
> > >
> > > > One item to watch out for:
> > > > 1. If you set a variable to a random number like: set var vrand =
> > > > (random(1000)) it will generate a number.
> > > > 2. if you exit rbase and restart it, define the variable again you
will
> > get
> > > > the same random number.
> > > >
> > > > rich
> > > > ----- Original Message -----
> > > > From: "A. Razzak Memon" <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Monday, April 23, 2001 10:35 AM
> > > > Subject: Re: Randomly generated unique numbers - Razzak's Reply
> > > >
> > > > >
> > > > > Bob,
> > > > >
> > > > > Use the R:BASE (RANDOM(value)) Function!
> > > > >
> > > > > http://www.RSyntax.com
> > > > >
> > > > > Enjoy!
> > > > >
> > > > > Very Best Regards,
> > > > >
> > > > > Razzak.
> > > > >
> > > > > At 10:05 AM 4/23/2001 -0400, Bob Powell wrote:
> > > > > >
> > > > > >Does anyone know how to randomly generate a nine
> > > > > >digit number that is always unique?
> > > > >
> > > > >
> > > > > ===================================-============================
> > > > > R:BASE Developers's Conference: http://www.rbase.com/conference
> > > > > Official R:BASE List Server: mailto:[EMAIL PROTECTED]
> > > > > RBTI Events/Training: http://www.rbase2000.com/events
> > > > > R:DCC Members: http://www.rbase2000.com/rdcc
> > > > > ================================================================
> > > > > R:BASE, Oterro & R:Tango are registered trademarks of RBTI.
> > > > > ==================================-=============================
> > >
>