[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: C rand() in Ruby

ara.t.howard

4/10/2008 6:28:00 PM


On Apr 10, 2008, at 10:20 AM, Chad Perrin wrote:
> Is there some simple way to make use of C's rand() from within Ruby?
> The daughter of someone I know is writing some toy scripts to compare
> PRNG results for a science fair project . . .

you mean other than just using

rand

??

you *can* directly call the C function using ruby/dl (see examples in
dist)

cheers.

a @ http://codeforp...
--
we can deny everything, except that we have the possibility of being
better. simply reflect on that.
h.h. the 14th dalai lama




2 Answers

Joel VanderWerf

4/10/2008 6:32:00 PM

0

ara.t.howard wrote:
>
> On Apr 10, 2008, at 10:20 AM, Chad Perrin wrote:
>> Is there some simple way to make use of C's rand() from within Ruby?
>> The daughter of someone I know is writing some toy scripts to compare
>> PRNG results for a science fair project . . .
>
> you mean other than just using
>
> rand

That would call ruby's mersenne twister, AFAIK.

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

ara.t.howard

4/10/2008 7:17:00 PM

0


On Apr 10, 2008, at 12:32 PM, Joel VanderWerf wrote:
> That would call ruby's mersenne twister, AFAIK.

yeah - i just wasn't clear on what was being asked - ruby/dl is the
ticket me thinks...

a @ http://codeforp...
--
we can deny everything, except that we have the possibility of being
better. simply reflect on that.
h.h. the 14th dalai lama