[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
How do random numbers work?
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 120
Thread images: 16
File: 1464720273269.jpg (6 KB, 300x300) Image search: [Google]
1464720273269.jpg
6 KB, 300x300
How do random numbers work?
>>
they just werk
>>
>>55443787
they're random
>>
File: doublesguy.jpg (12 KB, 248x249) Image search: [Google]
doublesguy.jpg
12 KB, 248x249
>>55444109
most of the time.
>>
>>55443787
They're based on using an unpredictable algorithm which is cheap to compute but difficult to reverse.

For example, you can construct a rudimentary random number generator by just using some sort of cryptographic hash function (e.g. SHA256) or block cipher (e.g. AES256).

As long as hash functions stay around (they will) and encryption isn't completely broken, you can generate unpredictable pseudorandom numbers.
>>
File: image.jpg (58 KB, 600x400) Image search: [Google]
image.jpg
58 KB, 600x400
>>55443787
Serious answer https://youtu.be/FfZurPKYM2w
>>
Look up linear congruence generator for a simple way to do it
>>
>>55443787
There are several methods(not an exhaustive list):

Data is taking from entropy generated from your computer and numbers are generated from this data.

A mathematical functions which generates predetermined numbers which appear to be random.

Data is taking from the environment cosmic radiation etc.


In short: there are no random numbers unless you generate them by using quantum effects.
>>
>>55444185
FSVO “random”.

In practice, true randomness is not a constraint you ever really need. All you need is unpredictability.
>>
You plant a seed and maybe a chicken will grow
>>
>>55444152
you fucking piece of shit cia scum
>>
Probaly Hashing the current time and date 300 times and getting the number in last index
>>
>>55444270
The current time and date is not random because it's almost completely predictable.
>>
>>55444282

Try to predict the current time and date when the time and date is updated at a rate of 3 gigahertz
>>
>>55444328
Seeding PRNG with time is fucking retarded is insecure.
>>
>>55444161
Pleasantly surprised at how accurate this video was.
>>
>>55444328
Okay. It's currently 2016-07-06 19:38:55
>>
>>55444384
Not him, but you are fucking inbred if you think seconds have no fractions. Aaaahahaha, watch racing much. Fucking keklles
>>
>>55444384
>>55444360
using all the way up to nanosecond
that would be totally random
>>
>>55444035
CIA nigger fuck off
>>
>>55444420
Depends on the purpose. If you're seeding a one-time key for long-term personal use based on the current nanoseconds at the time you created it, you're probably fine. (But still, why not just use /dev/random?)

If you're picking random numbers in repeated, predictable events (e.g. for establishing new HTTPS sessions), then picking the current time is absolutely retarded because I can do my own time measurements and perform correlation attacks.
>>
>>55444483
And what if you use the difference in time. Like ms lag added to time from a unknown server.
>>
>>55444544
If you add more and more entropy sources, your random numbers get more and more unpredictable.

But two caveats:
1. Never rely only on external entropy sources (since an attacker could control them)

2. Never rely only on the same type of entropy source (since it might not be as good as you first thought)

As a result, it's best to mix together many different entropy sources (interrupt timings, user inputs, bus jitter, voltage fluctuations, network packet delay, etc.) into a single entropy pool that is used to reseed your PRNG - which is exactly what /dev/random (and /dev/urandom) do.
>>
>>55444152
Nice try CIA nigger
>>
>>55444609
Makes sense anon
>>
File: 1373649344939.jpg (37 KB, 358x262) Image search: [Google]
1373649344939.jpg
37 KB, 358x262
>>55444152
>>
>>55444161
But she doesn't explain how the seed itself is generated, she said "take a random seed", but that's exactly the problem.
>>
File: seriously.png (131 KB, 256x364) Image search: [Google]
seriously.png
131 KB, 256x364
>>55444152
>>
>>55444860
See >>55444609
>>
>>55444185
>In short: there are no random numbers unless you generate them by using quantum effects.

What makes you think that? God doesn't play dice my friend.
>>
>>55445001
I agree, nothing is truly random, but this is not /phi/ but /g/
>>
>>55444035
Go away bad guy
>>
>>55445001
>>55445093
“Are quantum effects truly random?” is an inherently meaningless question. The answer doesn't affect us.

This is the question you're looking for:
“Are quantum effects unpredictable?” and the answer is yes.
>>
>>55445136
People also thought the weather was unpredictable 400 years ago, just because we have no method now doesn't mean it'll never exist.
>>
File: nine.png (24 KB, 640x189) Image search: [Google]
nine.png
24 KB, 640x189
>>
File: 1451108634978.png (29 KB, 800x473) Image search: [Google]
1451108634978.png
29 KB, 800x473
>>55445162
makes u think...
>>
>>55445162
Yes and in the year 2500 when we're all fugging space aliens from alpha centauri I'm sure we'll be using different PRNG seeds as well.

But now you're leaving the realm of reality and entering the domain of science fiction.
>>
>>55445427
Yes, the NY also reported that actual human flight would still take 10,000 years, just days before the Wright Brothers actually achieved it.
>>
>>55443787
In computing "random" isn't a thing. The word your looking for is pseudorandom. I.e. combining different formulas that are hard to predict or recreate. Computers can't actually make a random number, it's one of their inherent flaws. They are deterministic. So you'll always have someone trying to crack the formula to better guess the numbers produced and someone trying to make a better formula. There are ways to get numbers from other sources like electrical variances, but most common ones have their drawbacks too.
>>
>>55445427
I just want to believe, that's all
>>
>>55443787
The nigger believes he can predict random numbers with machine learning
>>
*holds up spork*
>>
>>55445464
There's a small difference between an engineering problem that we know is possible (e.g. birds) and a theoretical physics problem that all established laws of nature say are impossible.

A change of the status quo would require a fundamental violation of all established principles of quantum mechanics.
>>
>>55445843

Yes, such things happen all the time, the way we thought atoms looked has changed more than 4 times in the past 100 years, all changes we're quite fundamental.
>>
>>55445873
Well, feel free to come up with a revolutionary new model of quantum physics that will allow you to precisely measure the quantum state of the processor on a PC halfway across the globe in violation of the uncertainty principle and the laws of thermodynamics.

If you can do that, then feel free to spy on my anime collection. Until then, fuck off.
>>
But regarding our local programming domain.
Is generating random numbers using ever changing time on our local machine as input for our algorithm a good practice? I mean its always different number going in since its ticking timer...
>>
>>55443787
they're just numbers which were generated or derived from a non-deterministic source
that is, you should not be able to guess the next number

pseudo-random numbers are not truly random (may be deterministic), but are used in places where speed is more important, or there's no suitable sources to use
>>
>>55445915
I'm working on it, keep an eye on the news in 4000 years
>>
>>55445001

He can't play dice because he doesn't exist.
>>
>>55444544
How do dubs work?
>>
>>55445476

i cant code but wouldn't it be easy to generate a random number

just something like


//make an array of numbers 0-9

array [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

//magic coding thingy to choose one at random

from[array].random.print(array)

//this generates a random number

>>
>>55444161
Middle squares method, repeating patterns, and spaces...I learned more than I expected from this video, and I have some ideas now. Thank you based anon.
>>
what is more random
random(0-999)
or
random(0-9)
random(0-9)
random(0-9)
>>
itt: write a standlone random numbers in any language
>>
>>55446087
and how does .random work?
>>
>>55444161
so does this mean that Elon Musks idea (which is idiotic to me anyway) is literally impossible; we are a simulation inside a computer?

if randomness exists on the planet, but computers can't ever be random, then we must not be in a simulation
>>
>>55446087

Is that a troll attempt? If you had a magical function that chooses an index at random you'd already have a random function.

Possibilities to get pseudo random numbers:

- User input:
Let the user wiggle around with the mouse cursor -> record position -> random numbers

- Dedicated hardware:
Stuff like ARMs Trustzone or electrical Tubes which create random static.

Special algorithms:
Look up Mersenne Twister.
>>
is it really random or is it a program returning numbers in a set pattern that appears random?
>>
>>55446314
>randomness exists on the planet
like what?
>>
>>55446461
nope not a troll. i just thought i saw .random function in javascript before

but even if .random doesnt exist i cant image it be impossible to code. just make it so the computer chooses a number based on an image so it would look at the image, find its favorite color/pixel, and count the pixel in the image and display that number. repeat looking at that picture until all pixels have been looked at, then download a new picture.
>>
>>55446499
The latter. If you use the same seed you'd get the same sequences.
>>
>>55443787
https://www.youtube.com/watch?v=MiuLeTE2MeQ
>>
most random numbers are actually pseudorandom

which basically means just putting the current date through an algorithm that spits out a number
>>
>>55446503

i'm pretty sure its almost all random, there are too many examples to list so i will just say the first that came to mind;

if you drop some salt on the floor, and then do it again, it will never be exactly the same position/amount of salt/degrees/angles/distances from other grains of salt. you could try to match the exact conditions that you first used and it still wouldnt be the same.

but also other stuff, like no human will ever be alive again, its random, you cant have hitler then another exact hitler born 200 years later
>>
File: 1213645712312[1].jpg (12 KB, 384x384) Image search: [Google]
1213645712312[1].jpg
12 KB, 384x384
>>55443787
>tfw 3d loli FBI agents are trying to get your dick hard
>>
>>55446598
Sensitive to starting conditions != randomness
It's still just straight causality.
Randomness is the half life of an atom.
>>
>>55446615
>Randomness is the half life of an atom.
can you explain this anon? i dont understand
>>
File: cia-nigger-dildo.jpg (115 KB, 1280x702) Image search: [Google]
cia-nigger-dildo.jpg
115 KB, 1280x702
>>55444152
found you thru google images
>>
>>55443787
37
>>
>>55446159
none, assuming random is a uniform distribution
>>
>>55446650
Radioactive decay is a stochastic (i.e. random) process at the level of single atoms, in that, according to quantum theory, it is impossible to predict when a particular atom will decay.

Instead people just use the halflife, which is, if we have 1 Billion atoms, how long would it take for half, on average, to decay.

Basically, filliping a coin is random, but if you flip a billion coins, you can expect 500 million heads.
>>
File: 1466865337697.png (186 KB, 307x315) Image search: [Google]
1466865337697.png
186 KB, 307x315
What does based Terry A. Davis say about random numbers tho? Does God make them randomized or what?
>>
>>55446615
at an atomic level thats not random either, electron capture for example depends on the movement of the electron within the particle
>>
>>55446705
Yes, and God can manipulate random numbers to gives you messages.
>>
>>55446707
What does that have to do with nucleus decay with IS random
>>
>>55446705
He says a nigger can't understand random numbers
>>
>>55446733
But are we sure that radioactive decay is truly random or is it just that science has not found a way to predict it yet ?
>>
File: shrek.jpg (379 KB, 1680x1281) Image search: [Google]
shrek.jpg
379 KB, 1680x1281
>>55446705
1:30 in https://www.youtube.com/watch?v=denb9xfddZs

Why dont those stupid atheist niggers get random numbers?
>>
>>55446733
me blinking is also random then, it just depends on how im moving right now
>>
>>55446698
I just flipped a coin 10 times and i didn't get heads 5 times.
>>
>>55446915
Do you even math bro?
>>
>>55446915
Now do it 100000 times
>>
>>55446932
Oh sorry I meant to say 10 coins. I literally have 10 coins right now on me
>>
Itt: high school freshman trying to be witty
>>
>>55446948
Just flip them over and over again, and the more you do it the more likely the numbers are gonna tend to 50/50
>>
File: binomial.png (22 KB, 609x772) Image search: [Google]
binomial.png
22 KB, 609x772
>>55446915
The chance of getting exactly 5 heads when flipping 10 coins is only 25%.
>>
File: 1461361234164.jpg (25 KB, 400x323) Image search: [Google]
1461361234164.jpg
25 KB, 400x323
>>55445957
Entropy. There exists two macrostates: dubs and no dubs. The no dubs macrostate has more many more microstates (90/100) than the number of microstates for dubs (10/100). Despite dubs having low entropy and no dubs having high entropy, every single microstate is equally likely, yet getting dubs is less common because there are a lot less microstates for dubs.
>>
>>55447296
checkem
>>
>>55447367
>>55444544
>>
>>55447524
Now add up both n6mbers and see wtf you get
>>
>>55447538
AA88B8AB
>>
>>55444143
Not even dubs?
>>
>>55447367
Don't feel too bad. Your non dubs are just as rare as someone else's dubs :^)
>>
It's just hashing the date and time.
>>
post yfw you realize that whoever created this gay universe is a motherfucking gambler that needs rehab
>>
So all this got me wondering. Is trying to write a program to guess lotto numbers inherently pointless as well?
>>
>>55443787
>CIA nigger
That's like calling someone a Jewish nazi, fucking stupid
>>
>>55443787
A seed generates pseudorandom numbers

At uni we used arduinos antennae noise to scramble numbers even more
>>
>>55443787
Check out this very well developed psudo random number generator. The comments describe what is going on in the code.

http://www.pell.portland.or.us/~orc/Code/Misc/random.c
>>
>>55446836
that's the problem with randomness
you can prove something isn't random, but not that it is
>>
>>55450355
How do you prove that something isn't random?
>>
File: stallmans son.png (528 KB, 1024x768) Image search: [Google]
stallmans son.png
528 KB, 1024x768
>>
File: TERRYINTHEMATIX.png (4 MB, 2531x1965) Image search: [Google]
TERRYINTHEMATIX.png
4 MB, 2531x1965
>>55448196
>>
>>55450368
by finding a pattern
if you can determine what numbers will be generated, then the generation isn't random by definition
>>
>>55450422
And how do you determine what numbers will be generated? You can only take a finite sample, so you never know whether the next one will follow the pattern you think it does.
>>
File: 1464637492899.jpg (111 KB, 1280x702) Image search: [Google]
1464637492899.jpg
111 KB, 1280x702
>>55446655
you saved the wrong one dildo
>>
>>55443787
In VB apparently unless you tell the random number thing to randomize, you get the exact same numbers in the same order every time the program is run
>>
>>55450451
That's what makes them (pseudo)random. Random itself doesn't mean "unpredictable", it means "without inherent rules or structure"
So even a RNG engine using info from cosmic background radiation that could never realistically be reversed isn't truly random.

In other words, you don't need to know the full pattern set, just know enough to distinguish some kind of pattern.
>>
>>55444444
>>
>>55446532
That's still not random - it's completely deterministic (minor retardation like "find its favorite color/pixel" aside), and in a fatal way too. If somebody (i.e. the CIA or FBI) finds out where the pictures are being downloaded from, then they could easily poison your RNG.

It's clear you're not a troll, and that you're just trying to talk about a topic you know nothing about. Try reading about cryptography and its implementations
>>
>>55445476
>In computing "random" isn't a thing. The word your looking for is pseudorandom. I.e. combining different formulas that are hard to predict or recreate. Computers can't actually make a random number, it's one of their inherent flaws. They are deterministic.
They simply lack the correct hardware.

Weak radiation source, detector. Boom cheap totally unpredictable non deterministic random generator.
>>
>>55446836
>But are we sure that radioactive decay is truly random or is it just that science has not found a way to predict it yet ?
The ability to predict Q and W quark effects is not only something we can't do or reverse to deterministically create, we don't even have a suggestion of what might be a good starting point to investigate to do those things.

We can very accurately predict an average but have no means or even a hint of a means to predict any singular event.
>>
>>55450368
Develop an algorithm to predict it
>>
>>55450485
Pseudo-Random means YOU can't predict it

Random means it is uncertain *in reality* what it will be next, until it actually happens.

PRNGs are of the first kind, "real randomness" would be of the latter.

Even if there is a pattern, there can still be uncertainty. And I would disagree with your criteria for being "non-random" anyways, you haven't given any real standards for the pattern found. For example, "uniform distribution" and "normal distribution" are patterns that would still be considered random, provided you didn't already know these were deterministic.

>>55450888
How are you supposed to know that your algorithm matches the sequence for every element? It takes an infinite amount of time to check the equality of two infinite sequences.
>>
>>55452549
How are you supposed to know an apple falls down when you let it go
>>
>>55452795
You don't know, only that it makes sense to believe that it will, based on previous observations and time-tested theories. It is still possible that the laws of physics we observe are temporally local and everything would change completely tomorrow.
>>
>>55452844
Good job answering your own question
>>
>>55453010
My question was rhetorical in the first place. My point is that you cannot prove whether something is random.
>>
>>55453031
And my point is that this doesn't stop us assuming apples fall to the ground when you release them
>>
>>55453206
Ok? I never said you can't make useful predictions.
Thread replies: 120
Thread images: 16

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.