Random number not random

i read just now that python random function generate a pseud-random number with an algo called mersenne-twister.
What is the starting parameters that allow have the same random number in this shit?
I need to work with random numbers but i want to know if I can cheat a bit and have a random number from a sub-set of pseudo-random number.

Attached: MT.jpg (294x286, 32K)

Other urls found in this thread:

channel9.msdn.com/Events/GoingNative/2013/rand-Considered-Harmful
en.wikipedia.org/wiki/RdRand
twitter.com/SFWRedditVideos

pseudo-random actually > "true random" 99% of the cases

but i get the same number at every launch!
How is possible?

its called the seed, most random number generators have the option to set/get it

Sane libraries use cpu provided random number generators(except intel, which is shit) and linux generates random numbers with the help of interactions via kb and mouse.
What exactly are you trying to do?
>2
Here take this random number to aide you in your journey. I hope other anons can help you with their random numbers.

so i have to cheat with the seed?

you start an RNG with a seed. usually the system timer. If you start it with the same seed it'll result in the same sequence of random numbers

Cheat how?
What are you trying to do?

Yes you can.

Apply the system seeding function. Fill an array (100 elements is sufficient) with system generated random numbers.

Then for each request 1) generate a new system random number, 2) convert that number into an array index 3) Use the selected array element as return value 4) fill the array element with the system random number from the first step.

You didn't even read the OP, did you?

oh it suck for me. I don't want a random number based on time...
this is interesting

>I don't want a random number based on time...
thats not how it works

>What is the starting parameters that allow have the same random number in this shit?
The seed? Usually it's determined by a Time string, which is usually (but not always) in milliseconds. This number is fed into an algorithm which generates the random number.
>i want to know if I can cheat a bit and have a random number from a sub-set of pseudo-random number
technically, no. You're just modifying the algorithm, in a sense.

i have a vague idea of what i want, but i know better what i don't want.
I want to generate a random number in a subset of possible random number, and i want that this is the same (but random) forever

You can't cheat when it comes to random numbers. The law of large numbers will eventually catch up with you, and your data will have a bias.

that's my purpose user, im not scared of large number law

>this is interesting

This is a very old technique used to randomize the RNG on systems with poor or bad system generators.

use the same seed

"Pseudo-random" takes a random seed and generates a sequence of numbers out of it. It's deterministic based on seed, but the assumptions hold that you should not be able to predict next number, some pattern nor the initial seed out of anything. Obviously, seed needs to be really random and big enough to prevent brute-force cracking. Also having an uniform distribution from whole range.

Many times you want to provide your own range of numbers or use randomness efficiently to do things like shuffle, but it's a good design to have some random engine that generates stream of bytes and supply that to other random-oriented functions.

C++ also uses mersenne-twister, here's a presentation on that topic. Would recommend watching.
channel9.msdn.com/Events/GoingNative/2013/rand-Considered-Harmful

note that MT is not recommended for cryptographic use due to some subtle weaknesses, but it's the "generate few gigabytes of data to predict a small portion of bits" type of weakness. It's good enough for physics simulations and such

you may ask: why pseudo-random and not random when you can get strong randomness?
Because it's too slow to collect.

The joke is I tried to benchmark MT from C++ library and ChaCha20 from libsodium and it seems ChaCha is faster. Can someone benchmark it on your own machine and post independent results?

also the wheel is an old technology, but is everyday used with new scope

you know something more recent that work better?

>I don't want a random number based on time...
That's really the only conventional way to generate a psuedorandom number. I suppose you could generate a more truly-random number by reading audio, data, or wi-fi noise from the various peripherals of the device, but there's a matter of compatibility for such a solution.

just a reminder that there is no such thing as real randomness. randomness is like chaos or women, it is so complex that it seems inexplicable, but it isn't

You need a random seed data source, you most likely have hardware for it or /dev/urandom, however if you want true randomness get a gm counter.

en.wikipedia.org/wiki/RdRand

So what are you trying to do exactly? Random numbers are generally quite useless in small quantities.

They should just make a little device with a bunch of pointless sensors and have it generate random numbers from the data it receives.

something like this

you mean like a computer

I mean something that takes measurements like air pressure, temperature, humidity, radiation, etc. Just slap all the readings together randomly and use that as a random seed. Depending on how many decimal places you are going out, I doubt the readings will ever be exactly the same.

Europoor Discovers PRNG: The Thread

you can just read the random electrical charges in different parts of a computer and do the same thing

or you could just use unix time as a base which will literally never be the same and then season it with something like a record of the last few inputs received or previous RNG results

I bet OP, like Linus Torwalds, literally thinks that a system can "deplete its entropy pool"

...

Have this one: 6876843.3767604606021

Use a different seed you mong.