Jump to content

True random integer


mafioso
 Share

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
Link to comment
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 ...
 

Link to comment
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.

Link to comment
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 ...
 

Link to comment
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.)

Link to comment
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.

(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 ...
 

Link to comment
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.

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

Link to comment
Share on other sites

  • 4 months later...

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.

Link to comment
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!

: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 ...
 

Link to comment
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 ...
 

Link to comment
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.

Link to comment
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.

Link to comment
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.

:x:P

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...