• Quick note - the problem with Youtube videos not embedding on the forum appears to have been fixed, thanks to ZiprHead. If you do still see problems let me know.

Moderated Coin Flipper

I had to read a bit as javascript is not one of my core languages. Since 2015 the main browsers which actually provide the implementation of the ECMAscript standard have agreed on xorshift128+. See https://johnkavanagh.co.uk/writing/javascripts-math-random/
And still it's a balance between randomness and performance.
THE WRAP-UP
Fundamentally, any 'random' number that is generated programmatically actually is not random at all; any method used to generate these random numbers will eventually reveal repetition or patterns in the values they return.

At the end of the day, however, programming languages (and especially those for the web) need to be optimised for speed and performance above absolute randomisation. None of our web languages - at least for right now - use TRNGs and are truly random. However, our newer PRNGs are pretty good at what they do, and they’re pretty quick too. A comfortable middle-ground.

The actual random function from chromium source code at https://source.chromium.org/
// Static and exposed for external use.
static inline void XorShift128(uint64_t* state0, uint64_t* state1) {
uint64_t s1 = *state0;
uint64_t s0 = *state1;
*state0 = s0;
s1 ^= s1 << 23;
s1 ^= s1 >> 17;
s1 ^= s0;
s1 ^= s0 >> 26;
*state1 = s1;
}
 


Foster's video above certainly proved the concerns of jimbob and jsfisher and others to be antiquated baseless and wrong... and ironically even Foster's own baseless concern expressed in the very post in which he cites the vide that debunks his concerns.

Thanks Foster for that.:thumbsup:

Here is another video that rives asunder any other persistent and equally errant concerns...



Here is some of the transcript
well i thought we'd talk about something
um which
you know i've been looking into anyway
because um a part of my cryptography
teaching but it's the linear feedback
shift register
Edited by Agatha: 
Trimmed for rule 4
 
Last edited by a moderator:
I had to read a bit as javascript is not one of my core languages. Since 2015 the main browsers which actually provide the implementation of the ECMAscript standard have agreed on xorshift128+. See https://johnkavanagh.co.uk/writing/javascripts-math-random/
And still it's a balance between randomness and performance.

The actual random function from chromium source code at https://source.chromium.org/


Yes Wudang... if only you read this post which also showed the same thing long ago.

And which clearly debunks your concerns and any others... also see the video in the post above this one.

Do you think a PRNG that has a period of 2127 is good enough to simulate 10,000,000 coin tosses?

...
Why did you not "stumble" upon this 2018 article instead of one from 2015... but at least it is better than the book from 1965 CE that you tried to use earlier to denounce PRNGs altogether.
...
You might notice that this article shows how the article you happened to stumble upon is OUTDATED and obsolete.... QED!!!

..The important thing to know about all this is that (1) browsers decide which algorithm they want to use to calculate Math.random() and (2) in 2015 pretty much every browser (the major ones at least) ditched their old PRNG algorithms and now they all use the same one: called xorshift128+.
As it turns out, xorshift128+ does a significantly better job at being pretend-random than the older algorithms; plus it’s extremely light weight and computationally fast. So it was adopted pretty much across the board, which speaks volumes to its effectiveness when you consider that there had previously been a lot of differing opinions on the matter.
...
Conclusion (tl;dr)
To package everything up neatly, here’s an overview.

Question: how does JavaScript’s Math.random() generate random numbers?

Answer:

JS doesn’t do anything, it’s up to the browser

As of 2015, most browsers use an algorithm called xorshift128+

The numbers generated by xorshift128+ aren’t really random, the sequence just take a long time to repeat and they’re relatively evenly distributed over the expected range of values.

So, as it turns out, all we are really doing here is taking some input, swirling it around with some math, and spitting out a result. A completely predictable, nonrandom process. But one that feels random enough to us that it serves its purposes as our casual source of chaos in JavaScript.
 
Yes. Which makes it unsuitable for your coin flipper. Try making them Gaussian by summing the value of 5 calls to math.random as per the book I referenced. Or you can try googling stackoverflow


Amazingly perfect illustration of this post ... and a vivid demonstration of this post... and ironically of this one too.

From here
s... so these are used all the time for random
number generators advanced versions of
these are used for some of the most
popular random number generators right
the statistical randomness of these
streams is really really good and what i
mean by that is this will appear as random as just flipping a coin right so if you want to just generate coin flips this is a great way to do it this is not
cryptographically secure because if you


And from here

Monte Carlo simulation: Drawing a large number of pseudo-random uniform variables from the interval [0,1] at one time, or once at many different times, and assigning values less than or equal to 0.50 as heads and greater than 0.50 as tails, is a Monte Carlo simulation of the behavior of repeatedly tossing a coin.
 
Foster's video above certainly proved the concerns of jimbob and jsfisher and others to be antiquated baseless and wrong...

Which "concerns" would those be, and exactly what in the video proves them antiquated, baseless, and wrong?

Here is another video that rives asunder any other persistent and equally errant concerns...

Which "concerns" would those be, and exactly what in the video you cite proves them equally errant?
 
Yes, it is simulation of tossing a coin. As is your program. It's also poor simulation of that. Especially if you want to make claims about how random it is.
 
Facts that rive baseless concerns to smithereens



Thanks Foster for debunking your concerns and the others' in such a decisive way....:thumbsup:

Your video that you cited above and the video in this post irrefragably prove all the concerted repeated incessantly and relentlessly baseless concerns to be arrantly baseless.

And at the same time... ratified all my posts... and of course Coin Flipper 5 and its accompanying Coin Flipper Game.

I appreciate your contribution.:thumbsup:

Here is some of the transcript of your video with some of it highlighted... and below it are some of my previous posts that the video ratifies perfectly.

- When we observe the physical world
we find random fluctuations everywhere.
We can generate truly random numbers
by measuring random fluctuations, known as noise.
...
Edited by Agatha: 
Trimmed for rule 4


And here are some of my posts being ratified by your video... thanks again...:thumbsup:
Pseudo-random in computer random number generators means that an algorithm generated the sequence.... and the set of data is random in its arrangement.... but because it is algorithmic then the sequence will always generate the same set of random numbers if the same starting point is used (i.e. a seed).

And therein lies the BEAUTY of pseudo-random number generators.

The fact that you can have a set of random numbers that can be repeated is vital for testing and experimenting.
But... if the SEED... i.e. the atarting off point for the algorithm is changed then a totally different set of numbers is generated that is RANDOMLY different than the previous set.
Which is yet another very useful quality of pseudo-number generators.... in that you can now have two sets of random number randomly different from each other but can be repeated because you know the starting off SEED and of course the algorithm

However... if you do not know the SEED and you use a different seed all the time that you have no way of knowing or determining then the total set of random numbers is not pseudo-random anymore despite it being still algorithmic.
Of course all this is because we are using a computer and we want to SIMULATE things like REAL LIFE randomness.

Moreover... if the SEED is random then the whole process is random....

So despite the limitation of using a computer you can still have a TRUE random number generator by having a NATURAL SOURCE of randomness from REALITY... e.g. TIME for the easiest way to do it on a computer... but more fancy equipment can use radio signal noise or even the noise in the computer's own circuitry or for really fancy stuff using background microwave noise or radiation sources etc.
For the system I am using the SEED is randomized by using microsecs ticks of the computer's clock and thus every time you run the algorithm unless you can repeat the exact same microsecond of time and can predict when the key stroke happened to start the process off... it is random.
The other way to do it... is to actually get a coin and start tossing for 10,000,000 times and recording the results and then repeating that for say 150 times... how long do you think it will take?

However... this is a simulation of reality... reality is still random... fully random and the computer simulation gives us an extremely good simulation of this... without having to spend the rest of one's life doing the experiment.

As to your other question, if you know the seed values, you can repeat the calculation. That is not what happens with a genuine random event.


And when you do not... then you cannot... which is what happens in genuine random events.... no?

So when you use a random seed... it is random.

That is not random. That is with hidden variables..


Nope... it is with RANDOM variable just like in nature.

If the seed is an instant in time that you could not determine because it all depends on the instance of a key stroke or the instant when the algorithm is run to milliseconds which you have no way to predict because the OS is multitasking and could have queued the process or not and it could have been third or first etc. etc.
Or the seed could be noise in the machine or in the atmosphere etc. etc.

You know... random... as in unless you are god you cannot possibly predict or determine.
...

....
The point I was raising was the usability of the pseudorandom number generator for a sequence of one billion or more values. Yes, it will provide that many values, but at what point do the values no longer have the required properties?


The PRNG is not asked to provide 109 values.

It is asked to provide ONE value for each flip to decide the flip result.

Each flip is independent of the previous or any other flip.

Doing 107 flips is just like doing one flip 107 times.

And doing 100x107 is just like doing one flip at a time for 109 times.

The PRNG is not asked to produce more than one random number at a time each time there is a flip.

And each time the flip is done a new seed is used so a new sequence is generated from which one result is used for the flip.

So doing 10 flips the PRNG is asked 10 times each time anew to generate a new random number with a new seed.

Doing that 1000 times or 109 is the same.

In your QBasic it is like doing a RANDOMIZE TIMER before each time you use the Rnd function.

...reseeding itself is reseeding itself... get that?

And when reseeding happens the next sequence is different from the one before and is random.

If the first seed is an instant in time then unless you are OMNIPRESENT and OMNISCIENT you cannot figure out the first seed and thus not any other of the seeds and thus totally random numbers.
And what you said is that you doubt it can generate 109 random numbers.... can you now see that it can???

And why are you still harping on and on about this red herring... I thought you already chucked it back into the ocean????
 
Last edited by a moderator:
Yes, it is simulation of tossing a coin. As is your program. It's also poor simulation of that. Especially if you want to make claims about how random it is.

No it is not... your baseless bare assertion is arrantly errant... as proven by all the facts mentioned above.

If PRNGs were good enough for the Los Alamos Manhattan Project team to use to attain EMPIRICAL DATA and do empirical experimentation even in those halcyon days of 80 years ago and vacuum tube computers... it is certainly good enough to obtain EMPIRICAL DATA about a coin toss now with PRNGs that have random numbers generated in the "trillions upon trillions" of digits.

You are wrong... admit it and get it over with... just persisting in errors is not a rational thing to do.

Note: hey... thanks for admitting it is a simulation... it is an improvement from your previous denial it was a simulation at all.

...
Though if we use a seed large enough,
the sequence can expand
into trillions and trillions of digits before repeating.
...
 
Last edited:
Off topic but since this is in Computers and the Internet, a query to the computer literate:

Is it do-able to make a crude app or bot program that responds to keywords by reposting other posts and repeating strange phrases, producing a pseudo-randomly generated response, designed to delight its writer by reinforcing his delusions of brilliance? I ask merely for information.
 
Off topic but since this is in Computers and the Internet, a query to the computer literate:

Is it do-able to make a crude app or bot program that responds to keywords by reposting other posts and repeating strange phrases, producing a pseudo-randomly generated response, designed to delight its writer by reinforcing his delusions of brilliance? I ask merely for information.


You do not need the app Thermal... you are already doing that all by yourself.... or are you using an app already.... hmmmm???:confused::eek::eye-poppi
 
Which "concerns" would those be, and exactly what in the video proves them antiquated, baseless, and wrong?

All your posts... go read them...

And read this from the video...

so
these are used all the time for random
number generators advanced versions of
these are used for some of the most
popular random number generators right
the statistical randomness of these
streams is really really good and what i
mean by that is this will appear as
random
as just flipping a coin right so if you want to just generate coin flips this is a great way to do it



Which "concerns" would those be, and exactly what in the video you cite proves them equally errant?


All your posts were errant baseless antiquated concerns... go read them...

Also read this from the video...

this
lfsr has a period of two to 128 minus one let's say for the sake of argument
two to 128. this laptop given that it
has to output to the screen is doing
probably around a million bits per
second we will probably be waiting for 10 20 times the lifetime of the universe before this repeats itself so i don't
know how much


And here is Foster's video... again rending asunder all your errant concerns... just give up Foster... you are proven arrantly errant... give up and admit your errors.

- When we observe the physical world
we find random fluctuations everywhere.
We can generate truly random numbers
by measuring random fluctuations, known as noise.
...

- [Voiceover] For example, if we measure
the electric current of TV static over time,
we will generate a truly random sequence.
.
Edited by Agatha: 
Trimmed for rule 4
 
Last edited by a moderator:
Off topic but since this is in Computers and the Internet, a query to the computer literate:

Is it do-able to make a crude app or bot program that responds to keywords by reposting other posts and repeating strange phrases, producing a pseudo-randomly generated response, designed to delight its writer by reinforcing his delusions of brilliance? I ask merely for information.
I asked the same question in another thread with this interlocutor. The conclusion seems to converge on a specific answer...;)
 
Can you make a graph of 100 millions of your values ?

yes... I can... and so can you too... and you would know that if only you dared try Coin Flipper 5 even once.

Try it... it is not going to bite you...

Make sure you put the Edge Probability to 1 (i.e. no Edge allowed)...

You can do 100 runs of 1,000,000 flips in a run.

Or if you are patient enough you can do 1,000 runs of 100,000 flips in a run.

The app will give you the results for each run... and also the running average for the last run... but press the "Details" and you will be taken to a dialog that will show the running averages for each run.

Also there will be a "Graph" button that will graph the data of the runs and the running averages too.

You can interact with the graphs to Zoom and Pan and place the mouse on a point to get its value and you... there are icons at the top left of the graphs that if you rest the mouse on the icon will tell you what the icon does.

You can also save the graphs in their current states (zoomed panned etc.) as a PNG to your downloads folder.

There is also a "Copy" button that will copy the raw data to the clipboard where then you can go and put it in say Excel and you can graph it or whatever.

[IMGW=700]http://godisadeadbeatdad.com/CoinFlipperImages/CoinFlipper5_B.png[/IMGW]​
 
This thread is generating a disproportionate number of reports, chiefly for rule 4, rule 0 and rule 12. It would be exceptionally unusual for a thread in this subforum to be set to moderated status but unless the level of civility improves, that will happen.

Replying to this modbox in thread will be off topic  Posted By: Agatha
 
yes... I can... and so can you too... and you would know that if only you dared try Coin Flipper 5 even once.

Try it... it is not going to bite you...

Make sure you put the Edge Probability to 1 (i.e. no Edge allowed)...

You can do 100 runs of 1,000,000 flips in a run.

Or if you are patient enough you can do 1,000 runs of 100,000 flips in a run.

The app will give you the results for each run... and also the running average for the last run... but press the "Details" and you will be taken to a dialog that will show the running averages for each run.

Also there will be a "Graph" button that will graph the data of the runs and the running averages too.

You can interact with the graphs to Zoom and Pan and place the mouse on a point to get its value and you... there are icons at the top left of the graphs that if you rest the mouse on the icon will tell you what the icon does.

You can also save the graphs in their current states (zoomed panned etc.) as a PNG to your downloads folder.

There is also a "Copy" button that will copy the raw data to the clipboard where then you can go and put it in say Excel and you can graph it or whatever.

[IMGW=700]http://godisadeadbeatdad.com/CoinFlipperImages/CoinFlipper5_B.png[/IMGW]​

So you can't.
 
And here is Foster's video... again rending asunder all your errant concerns... just give up Foster... you are proven arrantly errant... give up and admit your errors.

- When we observe the physical world
we find random fluctuations everywhere.
We can generate truly random numbers
by measuring random fluctuations, known as noise.
...

- [Voiceover] For example, if we measure
the electric current of TV static over time,
we will generate a truly random sequence.
"The sky above the port was the color of television, tuned to a dead channel."

When have I, or anyone else in this thread, argued that there aren't ways to generate genuinely random numbers? Does your app use electrical noise from a CRT to generate its random numbers? If no, then what are you on about?
 
As per Agatha's mod box thread is now on moderated status. As ever don't try to raise this topic in any other thread.
Replying to this modbox in thread will be off topic  Posted By: Darat
 
May I ask, as others have, if OP can clarify what he believes he has demonstrated with his coin flipper? I am unable to determine this with any certainty after reading the thread.

My opinion, as a professional progammer since 1984, is that he has written a pseudo random number generator and the equivalent of a unit test for it. The test demonstrates that the PRNG has issues. I may have missed something so would appreciate clarification.
 

Back
Top Bottom