random/3 problems?

View: New views
2 Messages — Rating Filter:   Alert me  

random/3 problems?

by Dave Sworin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In gprolog 1.3.1 when I run random/3 with the call below I get integers.
random(1.0,10.0,RANDOM_NUMBER).
The 1.3.1 manual says that if both Base and Max are integers
then Number will be an integer.  I assumed this mean an integer
as determined by integer/1 built-in Prolog predicate.  ???
The work-around is easy enough with random/1 so this is not critical.
 
I also found the following calls to random/3 return the same random number:
:- randomize,random(1,10,M),randomize,random(1,10,N).  M and N are
the same.  This was only tested so far on a very old Fedora 2 platform,
Pentium III and I have not had a chance to try it on a more recent version
of Linux, but it doesn't seem right.  The actual calls where in two(2)
different goals, not right after each other, as shown above.
 
Dave
 


_______________________________________________
Bug-prolog mailing list
Bug-prolog@...
http://lists.gnu.org/mailman/listinfo/bug-prolog

Re: random/3 problems?

by Daniel Diaz-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dave Sworin wrote:
> In gprolog 1.3.1 when I run random/3 with the call below I get integers.
> random(1.0,10.0,RANDOM_NUMBER).
> The 1.3.1 manual says that if both Base and Max are integers
> then Number will be an integer.  I assumed this mean an integer
> as determined by integer/1 built-in Prolog predicate.  ???
> The work-around is easy enough with random/1 so this is not critical.

There is no bug here, 1.0 is not a Prolog integer.
>  
> I also found the following calls to random/3 return the same random number:
> :- randomize,random(1,10,M),randomize,random(1,10,N).  M and N are
> the same.  This was only tested so far on a very old Fedora 2 platform,
> Pentium III and I have not had a chance to try it on a more recent version
> of Linux, but it doesn't seem right.  The actual calls where in two(2)
> different goals, not right after each other, as shown above.

This is clearly a bug, thank you for the report.

Daniel


--
Ce message a ete verifie par MailScanner
pour des virus ou des polluriels et rien de
suspect n'a ete trouve.



_______________________________________________
Bug-prolog mailing list
Bug-prolog@...
http://lists.gnu.org/mailman/listinfo/bug-prolog