Click here to Skip to main content
15,891,704 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Math Namespace? Pin
leppie9-Jul-03 8:28
leppie9-Jul-03 8:28 
GeneralRe: Math Namespace? Pin
Not Active9-Jul-03 9:08
mentorNot Active9-Jul-03 9:08 
GeneralRe: Math Namespace? Pin
igor19609-Jul-03 7:21
igor19609-Jul-03 7:21 
GeneralRandom Number generation PROBLEM Pin
Member 4648617-Jul-03 9:49
Member 4648617-Jul-03 9:49 
GeneralRe: Random Number generation PROBLEM Pin
leppie7-Jul-03 10:08
leppie7-Jul-03 10:08 
GeneralRe: Random Number generation PROBLEM Pin
chris lasater7-Jul-03 10:29
susschris lasater7-Jul-03 10:29 
GeneralRe: Random Number generation PROBLEM Pin
leppie7-Jul-03 10:50
leppie7-Jul-03 10:50 
GeneralRe: Random Number generation PROBLEM Pin
chris Lasater7-Jul-03 11:05
susschris Lasater7-Jul-03 11:05 
So 'keystore' is a byte array I am using to initialize the RNGCryptoServiceProvider object. I could use nothing but thought this was more secure. I could not find enough info in the help files to tell me more, but I assumed since this is a Crypto object a key was a good idea.....

....Here I am getting the initial random object to be used below
Random rdm1 = new Random(unchecked((int)DateTime.Now.Ticks) * Environment.TickCount);
.....this is to be used by the RNGCryptoServiceProvider.GetBytes object method
.....as the passed in parameter
byte[] random = new Byte[100];

.....RNGCryptoServiceProvider is an implementation of a random number generator.
.....keystore is a byte array of random numbers used as a key
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(keystore);
try
{
.....here the byte array from above gets filled with random bytes
rng.GetBytes(random);
}
catch(CryptographicException e)
{
throw new ApplicationException("Random number generator threw an error:" + e.Message);
}
.....here we use a random byte from that array, chosen with the first Random object from above,
.....and times it by both the Environment.TickCount & DateTime.Now.Ticks
.....this makes sure we have a unique seed value every time.
int seed = ~unchecked((int)DateTime.Now.Ticks) * Environment.TickCount * random[rdm1.Next(random.Length - 1)];
......and we seed a new random object. I do this because I want to unique seed
Random rdm2 = new Random(seed);
I still get with a unique seed if I set the random max at 37 a patterned sequence
GeneralRe: Random Number generation PROBLEM Pin
leppie7-Jul-03 11:33
leppie7-Jul-03 11:33 
GeneralActive Directory Permissions Pin
DerekStrickland7-Jul-03 3:31
DerekStrickland7-Jul-03 3:31 
GeneralAnother question for "Interop GURUS" Pin
igor19606-Jul-03 12:06
igor19606-Jul-03 12:06 
GeneralRe: Another question for "Interop GURUS" Pin
Stephane Rodriguez.12-Jul-03 0:12
Stephane Rodriguez.12-Jul-03 0:12 
GeneralRe: Another question for "Interop GURUS" Pin
igor196012-Jul-03 6:27
igor196012-Jul-03 6:27 
GeneralRe: Another question for "Interop GURUS" Pin
Stephane Rodriguez.12-Jul-03 6:40
Stephane Rodriguez.12-Jul-03 6:40 
GeneralRe: Another question for "Interop GURUS" Pin
igor196012-Jul-03 7:00
igor196012-Jul-03 7:00 
GeneralRe: Another question for "Interop GURUS" Pin
Stephane Rodriguez.12-Jul-03 7:16
Stephane Rodriguez.12-Jul-03 7:16 
QuestionTlbImp.exe error: Any help? Pin
Anonymous5-Jul-03 5:49
Anonymous5-Jul-03 5:49 
AnswerRe: TlbImp.exe error: Any help? Pin
Nick Parker5-Jul-03 18:27
protectorNick Parker5-Jul-03 18:27 
General(Urgent) Visual JSharp silent mode installation Pin
Seetha Raman4-Jul-03 23:35
Seetha Raman4-Jul-03 23:35 
QuestionTelephony in .NET? Pin
J. Dunlap4-Jul-03 13:27
J. Dunlap4-Jul-03 13:27 
AnswerRe: Telephony in .NET? Pin
J. Dunlap5-Jul-03 18:31
J. Dunlap5-Jul-03 18:31 
GeneralCompact Framework and Cradle Pin
Braulio Dez4-Jul-03 6:41
Braulio Dez4-Jul-03 6:41 
General.NET Coders Wanted Pin
Derek Lakin4-Jul-03 5:18
Derek Lakin4-Jul-03 5:18 
GeneralRe: .NET Coders Wanted Pin
leppie4-Jul-03 7:07
leppie4-Jul-03 7:07 
GeneralRe: .NET Coders Wanted Pin
leppie4-Jul-03 7:33
leppie4-Jul-03 7:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.