True Random

08/10/2012 13:16 I don't have a username#1
Instead using the System.Random class and such, use a real random generator such as random.org's API.

C#:
[Only registered and activated users can see links. Click Here To Register...]

If you're interested in other languages:
[Only registered and activated users can see links. Click Here To Register...]

Actual API:
[Only registered and activated users can see links. Click Here To Register...]

So why is this better?
This might sum that up.
Quote:
Perhaps you have wondered how predictable machines like computers can generate randomness. In reality, most random numbers used in computer programs are pseudo-random, which means they are generated in a predictable fashion using a mathematical formula. This is fine for many purposes, but it may not be random in the way you expect if you're used to dice rolls and lottery drawings.

RANDOM.ORG offers true random numbers to anyone on the Internet. The randomness comes from atmospheric noise, which for many purposes is better than the pseudo-random number algorithms typically used in computer programs. People use RANDOM.ORG for holding drawings, lotteries and sweepstakes, to drive games and gambling sites, for scientific applications and for art and music. The service has existed since 1998 and was built and is being operated by Mads Haahr of the School of Computer Science and Statistics at Trinity College, Dublin in Ireland.

As of today, RANDOM.ORG has generated 1.15 trillion random bits for the Internet community.
:D

This should also solve all your "thread-safe" random problems.
08/10/2012 14:54 -impulse-#2
Big price to pay for not using System.Random... the price being the time to call that website api...

If you have troubles with the (thread-safe)ness of System.Random, build a wrapper around it and make it thread-safe.
08/10/2012 15:15 Korvacs#3
Definitely not worth it, System.Random has a good distribution so there isn't anything wrong with it, and as impulse said you can just wrap it to make it thread-safe, calling a website for a random number is ridiculous imo.
08/10/2012 20:38 InfamousNoone#4
Agreed with the two posts above, lol.
08/10/2012 23:25 pro4never#5
I shall follow the stream known as main.

That and they are absolutely correct. It's about 5-10 lines to code to make a threadsafe wrapper for it and maintain your efficiency versus incredibly expensive alternatives (such as calling a website api or a more thorough random generator used in high level encryption)
08/11/2012 00:13 InfamousNoone#6
When I need a ts-random I use a light-weight implementation which uses xor to generate values. Take a look at FastRandom's implementation by Collins Green.
08/11/2012 00:32 IAmHawtness#7
[Only registered and activated users can see links. Click Here To Register...]
08/11/2012 00:50 _Emme_#8
Quote:
Originally Posted by I don't have a username View Post
...
Off-topic, but what does your signature mean? What's up with Arco?
08/11/2012 00:56 CptSky#9
Quote:
Originally Posted by pro4never View Post
I shall follow the stream known as main.

That and they are absolutely correct. It's about 5-10 lines to code to make a threadsafe wrapper for it and maintain your efficiency versus incredibly expensive alternatives (such as calling a website api or a more thorough random generator used in high level encryption)
True. There is one in the CO2_CORE_DLL.

And, System.Random is enough random for most use...
08/11/2012 02:35 Silent-Death#10
bleah.. i clicked this thread excited i would see something new..
08/11/2012 02:38 diedwarrior#11
Quote:
Originally Posted by EmmeTheCoder View Post
Off-topic, but what does your signature mean? What's up with Arco?
He went to the army*I think*.
08/11/2012 05:07 Mind Fuck#12
Quote:
which means they are generated in a predictable fashion using a mathematical formula
does that include System.Random with time seed ?
anyway i think no one knows mathematical formula of system.random which makes it pretty enough for simple usage but thanks for sharing
08/11/2012 05:08 Mind Fuck#13
shitty connection double posted
08/11/2012 10:47 I don't have a username#14
Quote:
Originally Posted by EmmeTheCoder View Post
Off-topic, but what does your signature mean? What's up with Arco?
He went to the airforce lols :p

Quote:
Originally Posted by Mind Fuck View Post
does that include System.Random with time seed ?
anyway i think no one knows mathematical formula of system.random which makes it pretty enough for simple usage but thanks for sharing
Yes it does, because the seed is onyl set in the constructor.