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

.NET (Core and Framework)

 
GeneralRe: How to make callback from hosted managed component to unmanaged host? Pin
popopo9-Jul-03 9:26
popopo9-Jul-03 9:26 
GeneralRe: How to make callback from hosted managed component to unmanaged host? Pin
Heath Stewart11-Jul-03 8:14
protectorHeath Stewart11-Jul-03 8:14 
GeneralRe: How to make callback from hosted managed component to unmanaged host? Pin
igor196011-Jul-03 9:00
igor196011-Jul-03 9:00 
GeneralRe: How to make callback from hosted managed component to unmanaged host? Pin
Heath Stewart11-Jul-03 9:11
protectorHeath Stewart11-Jul-03 9:11 
GeneralRe: How to make callback from hosted managed component to unmanaged host? Pin
igor196011-Jul-03 9:28
igor196011-Jul-03 9:28 
GeneralRe: How to make callback from hosted managed component to unmanaged host? Pin
Heath Stewart11-Jul-03 9:43
protectorHeath Stewart11-Jul-03 9:43 
GeneralRe: How to make callback from hosted managed component to unmanaged host? Pin
igor196011-Jul-03 10:40
igor196011-Jul-03 10:40 
QuestionHow to make callback from hosted managed component to unmanaged host? Pin
popopo8-Jul-03 16:17
popopo8-Jul-03 16:17 
AnswerRe: How to make callback from hosted managed component to unmanaged host? Pin
igor19608-Jul-03 21:15
igor19608-Jul-03 21:15 
AnswerRe: How to make callback from hosted managed component to unmanaged host? Pin
leppie9-Jul-03 7:25
leppie9-Jul-03 7:25 
QuestionMath Namespace? Pin
igor19608-Jul-03 14:52
igor19608-Jul-03 14:52 
AnswerRe: Math Namespace? Pin
J. Dunlap8-Jul-03 17:41
J. Dunlap8-Jul-03 17:41 
AnswerRe: Math Namespace? Pin
leppie8-Jul-03 18:26
leppie8-Jul-03 18:26 
GeneralRe: Math Namespace? Pin
igor19608-Jul-03 19:55
igor19608-Jul-03 19:55 
AnswerRe: Math Namespace? Pin
James T. Johnson9-Jul-03 6:12
James T. Johnson9-Jul-03 6:12 
GeneralRe: Math Namespace? Pin
leppie9-Jul-03 7:17
leppie9-Jul-03 7:17 
GeneralRe: Math Namespace? Pin
Not Active9-Jul-03 8:14
mentorNot Active9-Jul-03 8:14 
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

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.