Alaska Software Inc. - re
Username: Password:
AuthorTopic: re
Chrisre
on Thu, 16 Sep 2004 15:18:21 +0100
My random numbers worked perfectly in Clipper 5.3 / Funcky.  However now I
use Alaska / XBTools, the random numbers are always the same :-

I have put this loop in 2 separate PRG's on 2 separate systems and get the
same results :-

FOR i = 1 TO 5
    qrandno = RANDOM()
    @ i+1 say qrandno
next

This sequence reports :-
49605 , 22654, 1716 , 9757 , 48979   everytime

Any suggestions ??????

Chris Palmer
Manchester
Phil Ide
Re: re
on Thu, 16 Sep 2004 15:27:16 +0100
Chris,
> My random numbers worked perfectly in Clipper 5.3 / Funcky.  However now I
> use Alaska / XBTools, the random numbers are always the same :-

The Rand() function needs seeding - I don't know about Random() but it
sounds like it needs seeding too.  I've no idea how to do that.

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

ERROR REALITY .SYS Not Found! - Reboot Universe? [Y,N]
Brent Dubs Re: re
on Thu, 16 Sep 2004 09:59:22 -0500
Try using Rand(-1) instead of random().  The -1 tell the function to 
seed the result from the system clock.

-Brent



Chris wrote:
> My random numbers worked perfectly in Clipper 5.3 / Funcky.  However now I
> use Alaska / XBTools, the random numbers are always the same :-
> 
> I have put this loop in 2 separate PRG's on 2 separate systems and get the
> same results :-
> 
> FOR i = 1 TO 5
>     qrandno = RANDOM()
>     @ i+1 say qrandno
> next
> 
> This sequence reports :-
> 49605 , 22654, 1716 , 9757 , 48979   everytime
> 
> Any suggestions ??????
> 
> Chris Palmer
> Manchester
> 
>