comp.lang.ada
 help / color / mirror / Atom feed
* Discrete random
@ 2000-09-10 18:34 Mathias Dolidon
  2000-09-10 18:39 ` Laurent Guerby
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Mathias Dolidon @ 2000-09-10 18:34 UTC (permalink / raw)


Look at this code :

with ada.numerics;
procedure ess is
package pnh is new ada.numerics.discrete_random(positive);

...

At compile time, GNAT answers there's no 'discrete_random' package in
'ada.numerics', but the reference manual specifies it. Where is the
matter ?

Thank you,

Mathias



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Discrete random
  2000-09-10 18:34 Discrete random Mathias Dolidon
@ 2000-09-10 18:39 ` Laurent Guerby
  2000-09-10 19:02   ` Mathias Dolidon
  2000-09-10 18:41 ` Mathias Dolidon
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Laurent Guerby @ 2000-09-10 18:39 UTC (permalink / raw)


Mathias Dolidon <matd@netcourrier.com> writes:

> Look at this code :
> 
> with ada.numerics;

with Ada.Numerics.Discrete_Random;

> procedure ess is
> package pnh is new ada.numerics.discrete_random(positive);
> 
> ...
> 
> At compile time, GNAT answers there's no 'discrete_random' package in
> 'ada.numerics', but the reference manual specifies it. Where is the
> matter ?

GNAT is right, Discrete_Random is a child package of Ada.Numerics
so you need an explicit with clause (as opposed to a nested
package, like the ones in Ada.Text_Io, where you need the with
clause only for the container one).

-- 
Laurent Guerby <guerby@acm.org>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Discrete random
  2000-09-10 18:34 Discrete random Mathias Dolidon
  2000-09-10 18:39 ` Laurent Guerby
@ 2000-09-10 18:41 ` Mathias Dolidon
  2000-09-10 19:19 ` (null)
  2000-09-11  4:07 ` David C. Hoos, Sr.
  3 siblings, 0 replies; 7+ messages in thread
From: Mathias Dolidon @ 2000-09-10 18:41 UTC (permalink / raw)


> At compile time, GNAT answers there's no 'discrete_random' package in
> 'ada.numerics', but the reference manual specifies it. Where is the
> matter ?

And I must add this : ada.numerics.flat_random works fine ! I really
don't understand what's on !



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Discrete random
  2000-09-10 18:39 ` Laurent Guerby
@ 2000-09-10 19:02   ` Mathias Dolidon
  2000-09-11 18:23     ` Laurent Guerby
  0 siblings, 1 reply; 7+ messages in thread
From: Mathias Dolidon @ 2000-09-10 19:02 UTC (permalink / raw)



OK. Thank you. And I'm sorry to disturb the newsgroup with my beginner's
questions but I really didn't see what the problem was.

> > Look at this code :
> >
> > with ada.numerics;
> 
> with Ada.Numerics.Discrete_Random;
> 
> > procedure ess is
> > package pnh is new ada.numerics.discrete_random(positive);
> >
> > ...
> >
> > At compile time, GNAT answers there's no 'discrete_random' package in
> > 'ada.numerics', but the reference manual specifies it. Where is the
> > matter ?
> 
> GNAT is right, Discrete_Random is a child package of Ada.Numerics
> so you need an explicit with clause (as opposed to a nested
> package, like the ones in Ada.Text_Io, where you need the with
> clause only for the container one).
> 
> --
> Laurent Guerby <guerby@acm.org>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Discrete random
  2000-09-10 18:34 Discrete random Mathias Dolidon
  2000-09-10 18:39 ` Laurent Guerby
  2000-09-10 18:41 ` Mathias Dolidon
@ 2000-09-10 19:19 ` (null)
  2000-09-11  4:07 ` David C. Hoos, Sr.
  3 siblings, 0 replies; 7+ messages in thread
From: (null) @ 2000-09-10 19:19 UTC (permalink / raw)


In article <39BBD440.6E19616@netcourrier.com>,
Mathias Dolidon  <matd@netcourrier.com> wrote:
>Look at this code :
>
>with ada.numerics;
>procedure ess is
>package pnh is new ada.numerics.discrete_random(positive);
>
>...
>
>At compile time, GNAT answers there's no 'discrete_random' package in
>'ada.numerics', but the reference manual specifies it. Where is the
>matter ?


Discrete_Random is a generic package.  You have to first instantiate
a package from the Discrete_Random Package with some discrete type.

For instance for an integer random number generator you would instantiate
something like-

   package Random_Integer is new Ada.Numerics.Discrete_Random (Integer);	

The ARM has a couple of good examples A.5.2.

-- 
=======================================================================
 Life is short.                  | Craig Spannring 
      Bike hard, ski fast.       | cts@internetcds.com
 --------------------------------+------------------------------------



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Discrete random
  2000-09-10 18:34 Discrete random Mathias Dolidon
                   ` (2 preceding siblings ...)
  2000-09-10 19:19 ` (null)
@ 2000-09-11  4:07 ` David C. Hoos, Sr.
  3 siblings, 0 replies; 7+ messages in thread
From: David C. Hoos, Sr. @ 2000-09-11  4:07 UTC (permalink / raw)


GNAT is correct.  There is no discrete_Random package _in_
Ada.Numerics.
Ada.Numerics.Discrete_Random is a _child package_ of
Ada.Numerics.

You need to say "with Ada.Numerics.Discrete_Random;"
instead of "with ada.numerics;"
"Mathias Dolidon" <matd@netcourrier.com> wrote in message
news:39BBD440.6E19616@netcourrier.com...
> Look at this code :
>
> with ada.numerics;
> procedure ess is
> package pnh is new ada.numerics.discrete_random(positive);
>
> ...
>
> At compile time, GNAT answers there's no 'discrete_random' package in
> 'ada.numerics', but the reference manual specifies it. Where is the
> matter ?
>
> Thank you,
>
> Mathias





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Discrete random
  2000-09-10 19:02   ` Mathias Dolidon
@ 2000-09-11 18:23     ` Laurent Guerby
  0 siblings, 0 replies; 7+ messages in thread
From: Laurent Guerby @ 2000-09-11 18:23 UTC (permalink / raw)


Mathias Dolidon <matd@netcourrier.com> writes:

> OK. Thank you. And I'm sorry to disturb the newsgroup with my beginner's
> questions but I really didn't see what the problem was.

There's no disturbance of newsgroup with beginner questions (at least
IMHO). 

BTW, may be you should look a bit at the Ada Rationale
<http://www.adapower.com/rationale/index.html>, the Part Three has an
overview of most of the standard package, and
<http://www.adapower.com/rationale/rat95-p3-a.html#3> has a few notes
on random number generation.

-- 
Laurent Guerby <guerby@acm.org>



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2000-09-11 18:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-09-10 18:34 Discrete random Mathias Dolidon
2000-09-10 18:39 ` Laurent Guerby
2000-09-10 19:02   ` Mathias Dolidon
2000-09-11 18:23     ` Laurent Guerby
2000-09-10 18:41 ` Mathias Dolidon
2000-09-10 19:19 ` (null)
2000-09-11  4:07 ` David C. Hoos, Sr.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox