From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c7fc42d2c6a0eedc X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-02 05:44:02 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news-FFM2.ecrc.net!news.iks-jena.de!not-for-mail From: Lutz Donnerhacke Newsgroups: comp.lang.ada Subject: Re: Ada2005 random Date: Wed, 2 Apr 2003 13:44:01 +0000 (UTC) Organization: IKS GmbH Jena Message-ID: References: NNTP-Posting-Host: taranis.iks-jena.de X-Trace: branwen.iks-jena.de 1049291041 30954 217.17.192.37 (2 Apr 2003 13:44:01 GMT) X-Complaints-To: usenet@iks-jena.de NNTP-Posting-Date: Wed, 2 Apr 2003 13:44:01 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.ada:35887 Date: 2003-04-02T13:44:01+00:00 List-Id: * Peter Hermann wrote: > In an application I need a variable discrete random function. > > Due to good reason I am reluctant to use my own very old > http://www.csv.ica.uni-stuttgart.de/ftp/pub/ada/ica/misc/randomph.txt > > Instead, I would prefer to use > generic > type Result_Subtype is (<>); > package Ada.Numerics.Discrete_Random is > > which offers a > function Random (Gen : Generator) return Result_Subtype; > > but does not offer something like > function Random (Gen : Generator; > from : Result_Subtype := Result_Subtype'first; > to : Result_Subtype := Result_Subtype'last) > return Result_Subtype; > which may or may not make sense in that raw disguise. What's wrong with the following? subtype Specialized_Result_Subtype is Result_Subtype range from .. to; package Specialized_Random is new package Ada.Numerics.Discrete_Random (Specialized_Result_Subtype);