Re: Does this generate a 64 bit random number

From: george r smith (gsmith_at_budgetext.com)
Date: 10/24/03


Date: Fri, 24 Oct 2003 15:04:46 -0500

Console.WriteLine(keys[count].ToString());

Sorry I thought I tried this but this time it worked :). So I just have my
original two questions:
1. Is the code the way to go
2. Is this newsgroup the Microsoft Managed Newsgroups that
they speak of in the MSDN site.
thanks again
grs

"george r smith" <gsmith@budgetext.com> wrote in message
news:%23Xc25WmmDHA.2528@TK2MSFTNGP12.phx.gbl...
> I forgot to ask how can I print out the random numbers.
>
> "george r smith" <gsmith@budgetext.com> wrote in message
> news:uUEuEKmmDHA.1800@TK2MSFTNGP10.phx.gbl...
> > Hi all,
> > I am trying to create a 64 bit random number using the
> > System.Security.Cryptography. Is the following code
> > how to do it (I know it does work but is it correct).
> >
> > Also, is this newsgroup the Microsoft Managed Newsgroups that
> > they speak of in the MSDN site.
> >
> > thanks
> > grs
> >
> > namespace rng_001
> > {
> > /// <summary>
> > /// Summary description RandomNumberGenerator
> > /// </summary>
> > class RandomNumberGenerator
> > {
> > public static System.UInt64[] keys = new System.UInt64[3];
> > /// <summary>
> > /// The main entry point for the application.
> > /// </summary>
> > [STAThread]
> > static void Main(string[] args)
> > {
> > byte[] random = new Byte[8];
> > RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
> > for (int count = 0; count < 3; count++)
> > {
> > rng.GetBytes(random);
> > keys[count] = BitConverter.ToUInt64(random,0);
> > }
> > Console.ReadLine();
> > }
> > }
> > }
> >
> >
>
>