[MonoDevelop] Real Range Random Generation

Ahmed Abdeen Hamed ahamed at uvm.edu
Tue Oct 19 16:36:07 EDT 2010


Hi Federico,
My apologies, I didn't mean to abuse the list. I will subscribe to
StackOverflow list.
And, thanks for your help. It works beautifully and ridiculously simple!
Ahmed


On Tue, Oct 19, 2010 at 4:30 PM, Federico Di Gregorio <fog at initd.org> wrote:
> On 19/10/2010 22:16, Ahmed Abdeen Hamed wrote:
>> Hello,
>> Is there is a straightforward way to generate random real numbers of a
>> range say -15.25 : 32.78 ?
>> I would appreciate any help,
>
> Questions like this one are better posted to places like StackOverflow.
> Anyway this is a solution to the problem:
>
> Random r = new Random();
> Console.WriteLine((32.78 - (-15.25)) * r.NextDouble() - 15.25);
>
> --
> Federico Di Gregorio                                       fog at initd.org
>  If a process is potentially good, but 90%+ of the time smart and
>  well-intentioned people screw it up, then it's a bad process.
>                                                          -- Steve Yegge
> _______________________________________________
> Monodevelop-list mailing list
> Monodevelop-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monodevelop-list
>


More information about the Monodevelop-list mailing list