Jump to content
Sign in to follow this  
mafioso

True random integer

Recommended Posts

mafioso

I couldn't find any functions that do this, so here's a quick snippet that takes a random number from random.org. I only needed integers, you can easily modify it for floats. Ofcourse, the downside is the time required for this (~5ms), but someone might find it useful:

Func _TrueRandom($min, $max)
    $ret = INetRead("http://www.random.org/integers/?num=1&min=" & $min & "&max=" & $max & "&col=1&base=10&format=plain&rnd=new")
    
    Return StringStripWS(BinaryToString($ret), 8)
EndFunc

Share this post


Link to post
Share on other sites
MvGulik

Nice if you need it. But ...

- Whats wrong with AutoIt's Random function?

- Random.org: Generating true random numbers takes time. RANDOM.ORG uses a simple quota system to make sure nobody hogs all the random numbers produced by the generator !


"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites
mafioso

Nice if you need it. But ...

- Whats wrong with AutoIt's Random function?

- Random.org: Generating true random numbers takes time. RANDOM.ORG uses a simple quota system to make sure nobody hogs all the random numbers produced by the generator !

AutoIt's random function is a pseudo-random function, meaning that it does not generate real random numbers. Check up pseudo-random number generators on wiki for a full explanation.

Share this post


Link to post
Share on other sites
Somerset

Any numbers generated by any computer "randomly "is pseudo. Unless "random.whateverthefuck.com" is using a person with real objects to generate the number, this entire thread makes no sense.


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites
MvGulik

AutoIt's random function is a pseudo-random function, meaning that it does not generate real random numbers. Check up pseudo-random number generators on wiki for a full explanation.

I don't care about how they are created or named in this context, only about how random the sequence is.

Saying that pseudo-random is no good just because there pseudo is meaningless to me. (lack of context)


"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites
crashdemons

Simple script to get a more-random value.

However, I must rant about the "true" part:

All values are a result of some process that creates or manipulates those values. Even static is the result of the process of bodies in space. If you knew the processes in question and the input, you could theoretically predict the results.

So, random values can only really be measured by the complicatedness and predictability of the process that created them. I can't really see anyone calling anything "truly" random.

Static is theoretically predictable but would be too massive an undertaking for any mortal to predict - but it's still not truly random.

Some of the generators that apply quantum properties might as well be on the upper end of that, hardest to predict if not beyond humans.

Frankly I'd rather call this "random enough".

Edit: rant is collapsible.

Edited by crashdemons

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Share this post


Link to post
Share on other sites
MvGulik

crashdemons:

The "True random" part is the one thing that I really don't like about the random.org site. They should know better, but than again there selling there randomness.

Datenshi:

Maybe.

But his contribution/suggestion effect is properly not better random value sequences. (if they are, I think your going to be hard pressed to proof them really better and that you really need them. But than again I'm no jchd.)

But it could contribute to unnecessary use of the random.org site just for the sake of this "true random" versus "(AutoIt/Mersenne Twister) pseudo random" part.

(Ps: I think I'm more or less done randomizing about this.)

Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites
LoWang

atmospheric noise random generator is not random enough for me ;)

Share this post


Link to post
Share on other sites
TheSaint

But it could contribute to unnecessary use of the random.org site just for the sake of this "true random" versus "(AutoIt/Mersenne Twister) pseudo random" part.

I agree, that we should discourage the unnecessary use/promotion of a site for a very doubtful benefit ... certainly in code anyway ... and especially where there might be an ulterior motive involved.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites
WeirdHero

I agree, that we should discourage the unnecessary use/promotion of a site for a very doubtful benefit ... certainly in code anyway ... and especially where there might be an ulterior motive involved.

Sorry to bump this but i don't see what all the fuss is about.

I don't think using random.org is such a bad thing since they ARE LETTING you utilize their service/servers in a generous way.

For example, i used mafioso's snippet to modify the wonderful Shuffler application to use random.org instead of the Random function, which is something i wanted to do for a while but didn't really know how.

I only use ir a few times in a month.

And no, i am not going to share it because of bugs which may stem from my awful programming skills.

Share this post


Link to post
Share on other sites
MvGulik

i don't see what all the fuss is about.

I don't think using random.org is such a bad thing since they ARE LETTING you utilize their service/servers in a generous way.

For example, i used mafioso's snippet to modify the wonderful Shuffler application to use random.org instead of the Random function, which is something i wanted to do for a while but didn't really know how.

I only use ir a few times in a month.

Than I suggest you reread the whole topic again.

tip: Its not really about the random.org site itself. Or any other site that might provide a similar service.

And no, i am not going to share it because of bugs which may stem from my awful programming skills.

Strange way to finish your (assuming) first message on this forum like that!

:x


"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites
WeirdHero

Strange way to finish your (assuming) first message on this forum like that!

Sorry, that is a side effect of my dysfunctional left brain lobe and poor mathematical aptitude.

Share this post


Link to post
Share on other sites
lunarblaze

before bashing this guy for not reading, why dont you do as was earlier suggested and read the wiki

and just to make it easy: http://en.wikipedia.org/wiki/Pseudorandom

Share this post


Link to post
Share on other sites
MvGulik

Seems this Topic is blessed with some random attraction magic.

Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites
JoHanatCent

random attraction magic.

You did a pretty good job over here:

Maybe you can do some scientific comparrisons and probbably come to the conclusion that all computer generated randomness is in fact

Pseudo random!


Share this post


Link to post
Share on other sites
FireFox

Nothing can be "true random" because random algorithms refer to something.

Most humans would do the same if they think a little to give you a random number.

So in my point of view, this topic has no interest :/

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
pedmacedo

Nothing can be "true random" because random algorithms refer to something.

Most humans would do the same if they think a little to give you a random number.

So in my point of view, this topic has no interest :/

Br, FireFox.

There are ways of obtaining true random numbers, but it's not by using an algorithm. In a quick search I found this:

A hardware (true) random number generator is a piece of electronics that plugs into a computer and produces genuine random numbers as opposed to the pseudo-random numbers that are produced by a computer program such as newran. The usual method is to amplify noise generated by a resistor (Johnson noise) or a semi-conductor diode and feed this to a comparator or Schmitt trigger. If you sample the output (not too quickly) you (hope to) get a series of bits which are statistically independent. These can be assembled into bytes, integers or floating point numbers and then, if necessary, into random numbers from other distributions using methods such as those in newran.

Share this post


Link to post
Share on other sites
TheSaint

For our programming purposes here, with AutoIt, how random does random need to be?

It's a bit like having a Chinese meal in a Chinese restaurant made by Chinese employees from Chinese ingredients cooked in a Chinese way .... but saying it's not Chinese, because the restaurant is in New York and not China.

When will it ever be good enough?

In China obviously.

:x:P


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×