Does this generate a 64 bit random number
From: george r smith (gsmith_at_budgetext.com)
Date: 10/24/03
- Next message: george r smith: "Re: Does this generate a 64 bit random number"
- Previous message: Doug Bahr: "Help on Creating a Custom Permission"
- Next in thread: george r smith: "Re: Does this generate a 64 bit random number"
- Reply: george r smith: "Re: Does this generate a 64 bit random number"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Fri, 24 Oct 2003 14:10:39 -0500
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();
}
}
}
- Next message: george r smith: "Re: Does this generate a 64 bit random number"
- Previous message: Doug Bahr: "Help on Creating a Custom Permission"
- Next in thread: george r smith: "Re: Does this generate a 64 bit random number"
- Reply: george r smith: "Re: Does this generate a 64 bit random number"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]