Math.random in mode:gpu

A GIF or MEME to give some spice of the internet

What is wrong?

The random number distribution is Normal instead of Uniform[0,1]

Where does it happen?

Ex. In GPU.js when I run Math.random inside a gpu.createKernel(function() in Node.js on my pc windows 10 and Nvidia GPU
NB If mode is set to cpu, all else equal, the numbers are Unifom

How do we replicate the issue?

const { GPU } = require('gpu.js');
const gpu = new GPU({ mode: 'gpu' });
const nobs=10000;

const kernel = gpu.createKernel(function() {
const y=Math.random();
return y;
}, { output: [nobs] });
const data = kernel();

How important is this (1-5)?

5

Expected behavior (i.e. solution)

the data should be uniform

Other Comments

Probably, in the plugin you should have chosen nrandom instead of n4random.