|
You last visited: Today at 21:48
Advertisement
True Random
Discussion on True Random within the CO2 Programming forum part of the Conquer Online 2 category.
08/10/2012, 13:16
|
#1
|
elite*gold: 0
Join Date: Dec 2011
Posts: 1,537
Received Thanks: 785
|
True Random
Instead using the System.Random class and such, use a real random generator such as random.org's API.
C#:
If you're interested in other languages:
Actual API:
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.
|
This should also solve all your "thread-safe" random problems.
|
|
|
08/10/2012, 14:54
|
#2
|
elite*gold: 0
Join Date: Oct 2009
Posts: 768
Received Thanks: 550
|
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
|
#3
|
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
|
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
|
#4
|
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,885
|
Agreed with the two posts above, lol.
|
|
|
08/10/2012, 23:25
|
#5
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
|
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
|
#6
|
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,885
|
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
|
#7
|
elite*gold: 20
Join Date: Aug 2007
Posts: 1,749
Received Thanks: 2,199
|
|
|
|
08/11/2012, 00:50
|
#8
|
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,162
|
Quote:
Originally Posted by I don't have a username
...
|
Off-topic, but what does your signature mean? What's up with Arco?
|
|
|
08/11/2012, 00:56
|
#9
|
elite*gold: 0
Join Date: Jan 2008
Posts: 1,443
Received Thanks: 1,175
|
Quote:
Originally Posted by pro4never
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
|
#10
|
elite*gold: 0
Join Date: Jan 2006
Posts: 1,055
Received Thanks: 296
|
bleah.. i clicked this thread excited i would see something new..
|
|
|
08/11/2012, 02:38
|
#11
|
elite*gold: 0
Join Date: Jun 2009
Posts: 611
Received Thanks: 195
|
Quote:
Originally Posted by EmmeTheCoder
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
|
#12
|
elite*gold: 0
Join Date: Jul 2012
Posts: 34
Received Thanks: 2
|
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
|
#13
|
elite*gold: 0
Join Date: Jul 2012
Posts: 34
Received Thanks: 2
|
****** connection double posted
|
|
|
08/11/2012, 10:47
|
#14
|
elite*gold: 0
Join Date: Dec 2011
Posts: 1,537
Received Thanks: 785
|
Quote:
Originally Posted by EmmeTheCoder
Off-topic, but what does your signature mean? What's up with Arco?
|
He went to the airforce lols
Quote:
Originally Posted by Mind ****
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.
|
|
|
 |
Similar Threads
|
[SALE] Random ISRO chars in random servers CHEAP, from 1$ to 3$
06/03/2012 - Silkroad Online Trading - 4 Replies
Hello, I want to sell all those chars very cheap for PayPal money from 1$ to 3$ , because I need some money to buy usb joystick to play FIFA on pc ^^
If you buy them all, I can sell all those chars for 15$!!!
Contacts - skype: myntex2
I ACCEPT PAYPAL ONLY
So let's start:
|
True Classic - A True Co Classic PServer
12/23/2011 - CO2 PServer Archive - 53 Replies
Deleted.
If you like communism and like being ruled by an unfair dictator. Please go here.
www.trueclassic.net
otherwise go here
www.explicitintentions.net
|
************** true buddy true BOT for aion
10/09/2009 - Aion Hacks, Bots, Cheats & Exploits - 14 Replies
My friend has Aionbuddy Aion Bot • Index page its the korean bot EVERYONE is talking about but No ONE has but he does its 15 usd a month its expensive yes but watch the short video he made I use this thing and WOWOWOW.
Aionbuddy Aion Bot • Index page and you can msn him and email him to buy it =)
|
All times are GMT +1. The time now is 21:49.
|
|