# True random integer

## Recommended Posts

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 on other sites

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 on other sites

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 on other sites

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

Madness is the first step to understanding...

##### Share on other sites

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 on other sites

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 on other sites

Think you're being a bit hard on the guy, he's no scientist, but he's contributing to the AutoIT community which he should be commended for, big or small

Edited by Datenshi

##### Share on other sites

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.

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 on other sites

atmospheric noise random generator is not random enough for me

##### Share on other sites

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)

##### Share on other sites

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 on other sites

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!

"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 on other sites

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 on other sites

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 on other sites

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 on other sites

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 on other sites

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 on other sites

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 on other sites

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.

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)

## Create an account

Register a new account

×

• Wiki

• Back

• Git