[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Normal Dist solved
From: |
Sven N. Thommesen |
Subject: |
Re: Normal Dist solved |
Date: |
Tue, 07 Jul 1998 09:36:13 -0500 |
At 02:44 PM 7/7/1998 +0200, you wrote:
>Hi all
> I solved my previous problem with Normal Dist.
>The method is
>-alex {
>int result;
>int seed = 25699870;
>id normalDR, randomGeneratorR;
>randomGeneratorR = [PMMLCG1 create: globalZone setStateFromSeed: seed];
>
>normalDR = [NormalDistribution create: globalZone
>setGenerator:randomGeneratorR];
>result = [normalDR getSampleWithMean: 0 withVariance: 0.5];
>printf (" Normal Value ---> %d\n ", result);
>return self;
>
>}
>
>Is it right?
>The only problem is that the result is ALWAYS 0!! sigh sigh sigh!!!
>Any ideas?
> ALEX
The output from a call to getSampleWithMean:withVariance is of type double,
so in your code the double gets cast to an integer. Evidently you hadn't
gotten any values > 1.0 yet. Also, the seed should be an unsigned integer,
different from zero.
We now have the pleasure of being able to tell everyone to RTFM -- since
the Swarm team *finally* produced a Fine Manual ... ;-)
Cheers,
--Sven
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.
==================================