Skip to main content
fix wording
Source Link
ETHproductions
  • 50.1k
  • 6
  • 94
  • 240

JavaScript (ES6), 78 75 bytes

x=>x.map(y=>y.map(z=>+s.splice(Math.random()*s.length,1)),s=eval(`[${x}]`))

This is the first time I can remember using .splice() in a code-golf challenge...

You can golf off two bytes by sortingshuffling the array beforehand:

x=>x.map(y=>y.map(z=>s.pop()),s=eval(`[${x}]`).sort(_=>Math.random()-.5))

However, this seems to put the last integer first the majority of the time, so I'm going to assume that the integers aren't uniformly distributed.

JavaScript (ES6), 78 75 bytes

x=>x.map(y=>y.map(z=>+s.splice(Math.random()*s.length,1)),s=eval(`[${x}]`))

This is the first time I can remember using .splice() in a code-golf challenge...

You can golf off two bytes by sorting the array beforehand:

x=>x.map(y=>y.map(z=>s.pop()),s=eval(`[${x}]`).sort(_=>Math.random()-.5))

However, this seems to put the last integer first the majority of the time, so I'm going to assume that the integers aren't uniformly distributed.

JavaScript (ES6), 78 75 bytes

x=>x.map(y=>y.map(z=>+s.splice(Math.random()*s.length,1)),s=eval(`[${x}]`))

This is the first time I can remember using .splice() in a code-golf challenge...

You can golf off two bytes by shuffling the array beforehand:

x=>x.map(y=>y.map(z=>s.pop()),s=eval(`[${x}]`).sort(_=>Math.random()-.5))

However, this seems to put the last integer first the majority of the time, so I'm going to assume that the integers aren't uniformly distributed.

added 294 characters in body
Source Link
ETHproductions
  • 50.1k
  • 6
  • 94
  • 240

JavaScript (ES6), 78 75 bytes

x=>x.map(y=>y.map(z=>+s.splice(Math.random()*s.length,1)),s=eval(`[${x}]`))

This is the first time I can remember using .splice() in a code-golf challenge...

You can golf off two bytes by sorting the array beforehand:

x=>x.map(y=>y.map(z=>s.pop()),s=eval(`[${x}]`).sort(_=>Math.random()-.5))

However, this seems to put the last integer first the majority of the time, so I'm going to assume that the integers aren't uniformly distributed.

JavaScript (ES6), 78 75 bytes

x=>x.map(y=>y.map(z=>+s.splice(Math.random()*s.length,1)),s=eval(`[${x}]`))

This is the first time I can remember using .splice() in a code-golf challenge...

JavaScript (ES6), 78 75 bytes

x=>x.map(y=>y.map(z=>+s.splice(Math.random()*s.length,1)),s=eval(`[${x}]`))

This is the first time I can remember using .splice() in a code-golf challenge...

You can golf off two bytes by sorting the array beforehand:

x=>x.map(y=>y.map(z=>s.pop()),s=eval(`[${x}]`).sort(_=>Math.random()-.5))

However, this seems to put the last integer first the majority of the time, so I'm going to assume that the integers aren't uniformly distributed.

golfed 3 bytes
Source Link
ETHproductions
  • 50.1k
  • 6
  • 94
  • 240

JavaScript (ES6), 7878 75 bytes

x=>x.map(y=>y.map(z=>sz=>+s.splice(Math.random()*s.length,1)[0]),s=s=eval(x+""`[${x}]`).split`,`)

This is the first time I can remember using .splice() in a code-golf challenge...

JavaScript (ES6), 78 bytes

x=>x.map(y=>y.map(z=>s.splice(Math.random()*s.length,1)[0]),s=(x+"").split`,`)

This is the first time I can remember using .splice() in a code-golf challenge...

JavaScript (ES6), 78 75 bytes

x=>x.map(y=>y.map(z=>+s.splice(Math.random()*s.length,1)),s=eval(`[${x}]`))

This is the first time I can remember using .splice() in a code-golf challenge...

Source Link
ETHproductions
  • 50.1k
  • 6
  • 94
  • 240
Loading