[bigint] bigint Digest, Vol 15, Issue 1

Nicolas Carrasco <ncarrasco2006 at hotmail.com>
Tue Jun 22 15:37:15 PDT 2010


Hi Matt,

There isnt a BiguUsngined function. 

I can implement the random generator for your Library if you can help me with routines to interface with Big Integer library.

Please let me know if you can and are interested in.

Best,
Nicolas.

> From: bigint-request at mattmccutchen.net
> Subject: bigint Digest, Vol 15, Issue 1
> To: bigint at mattmccutchen.net
> Date: Mon, 21 Jun 2010 12:00:02 -0700
> 
> Send bigint mailing list submissions to
> 	bigint at mattmccutchen.net
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	https://mattmccutchen.net/mailman/listinfo/bigint
> or, via email, send a message with subject or body 'help' to
> 	bigint-request at mattmccutchen.net
> 
> You can reach the person managing the list at
> 	bigint-owner at mattmccutchen.net
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of bigint digest..."
> 
> 
> Today's Topics:
> 
>    1. Question (Nicol?s Carrasco)
>    2. Re: Question (Matt McCutchen)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Sun, 20 Jun 2010 15:58:48 -0300
> From: Nicol?s Carrasco <ncarrasco2006 at gmail.com>
> To: bigint at mattmccutchen.net
> Subject: [bigint] Question
> Message-ID:
> 	<AANLkTim3AFvuhik-2c7xR2TTMyzy2vjsxZRWyya5u5ni at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Hello Matt,
> 
> I need to write a pseudo random number generator, for first aproach using
> standard c++ rand function.
> 
> Can you give me an example o how to put random generated bits by rand() to a
> BigUnsigned?
> 
> Many thanks,
> Nicolas.
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mattmccutchen.net/mailman/archives/bigint/attachments/20100620/acdab150/attachment-0001.html>
> 
> ------------------------------
> 
> Message: 2
> Date: Sun, 20 Jun 2010 15:30:28 -0400
> From: Matt McCutchen <matt at mattmccutchen.net>
> To: Nicol?s Carrasco <ncarrasco2006 at gmail.com>
> Cc: bigint at mattmccutchen.net
> Subject: Re: [bigint] Question
> Message-ID: <1277062229.1964.15.camel at mattlaptop2.local>
> Content-Type: text/plain; charset="UTF-8"
> 
> On Sun, 2010-06-20 at 15:58 -0300, Nicol?s Carrasco wrote:
> > I need to write a pseudo random number generator, for first aproach
> > using standard c++ rand function.
> > 
> > Can you give me an example o how to put random generated bits by
> > rand() to a BigUnsigned?
> 
> There are two general approaches:
> 
> 1. Cast the return value of rand() to a BigUnsigned and use the bitwise
> shift and OR operators to deposit it in the appropriate place, something
> like this:
> 
> BigUnsigned buf(0);
> for (int i = 0; i < n; i++)
>     buf |= BigUnsigned(rand()) << (i * RAND_BITS);
> 
> This is really easy, but unfortunately it takes quadratic time to fiddle
> with all the low-order zeros created by the shifting.
> 
> 2. Fill an array of some integral type with random bits from rand() and
> pass it to the dataToBigInteger function.  (There should really be a
> BigUnsigned version of that function.)  Unfortunately, if your rand() is
> like mine and provides 31 random bits at a time, you'll need to either
> take extra steps to get a 32nd bit or take only 16 of the bits and waste
> the rest.
> 
> Random number generation is something that perhaps the library could
> support better.  I'll keep it in mind.
> 
> -- 
> Matt
> 
> 
> 
> ------------------------------
> 
> _______________________________________________
> bigint at mattmccutchen.net mailing list
> To unsubscribe or change options, go to: https://mattmccutchen.net/mailman/listinfo/bigint
> 
> 
> End of bigint Digest, Vol 15, Issue 1
> *************************************
 		 	   		  
_________________________________________________________________

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mattmccutchen.net/mailman/archives/bigint/attachments/20100622/e37a6f35/attachment.htm>


More information about the bigint mailing list