|
|
On 1-2-2016 13:19, William F Pokorny wrote:
> On 02/01/2016 03:06 AM, Thomas de Groot wrote:
>> On 1-2-2016 3:10, clipka wrote:
>>> Am 01.02.2016 um 02:55 schrieb Mike Horvath:
>>>> How do I calculate a random integer between n and p, inclusively?
>>>
>>> floor( rand(R)*((p-n)+1) + 0.5 )
>>>
>>> should do the trick
>>>
>>
>> Why not this: int(RRand(n,p,R))
>>
> RRand(Min,Max,RandSeededStream) from rand.inc. To get the inclusive part
> of the request I think we need:
>
> int(RRand(n,p+(1-1e-6),R))
>
> or
>
> floor(RRand(n,p+(1-1e-6),R))
>
> Bill P.
Are the Min and Max not inclusive by default? I always got that impression.
--
Thomas
Post a reply to this message
|
|