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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8147387fe25d4e2a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Mart van de Wege Newsgroups: comp.lang.ada Subject: Re: Random number generation Date: Thu, 30 Dec 2010 16:37:06 +0100 Message-ID: <861v4z46hp.fsf@gareth.avalon.lan> References: <864o9vbkwz.fsf@gareth.avalon.lan> <8o3920Fn0vU1@mid.individual.net> <4d1c72cf$0$6772$9b4e6d93@newsspool3.arcor-online.net> <86pqsja1n3.fsf@gareth.avalon.lan> <4d1ca53c$0$6765$9b4e6d93@newsspool3.arcor-online.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: individual.net SNYyag1BqEdkg5cN9z9Okglbn6w+k+HeyuetG1Wc1WJk9HKVyI X-Orig-Path: gareth.avalon.lan!not-for-mail Cancel-Lock: sha1:mJyc7yOFiyhAyzni4ZPgMHelQtE= sha1:H0VMotnzNXhAcPVvooyBbkADIdY= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Xref: g2news1.google.com comp.lang.ada:16263 Date: 2010-12-30T16:37:06+01:00 List-Id: Georg Bauhaus writes: > On 30.12.10 13:25, Mart van de Wege wrote: >> Georg Bauhaus writes: >>> >>> OTOH, the Size parameter is fixed at 6, so subtype Die_Size and >>> the generator could be placed outside Roll. Anyway, another >>> nest will give suitable life times to the objects involved. >>> >> How does that work? > > Using another level of nesting to control life time > and parameterization: Yeah, after some time pondering on it, I was going for a similar solution; I was thinking of doing it the traditional OO way, using a constructor method to return a Dice_Pool object with the Generator intialized, and a Roll method to generate a result. Hadn't thought of the exact way to implement this, but it would not have looked a lot different from your example. Thanks, Mart -- "We will need a longer wall when the revolution comes." --- AJS, quoting an uncertain source.