Skip to main content
Golfed some unnecessary characters (mostly from the list command).
Source Link
bmarks
  • 2.1k
  • 11
  • 13

STATA, 172161

di _r(s) set obsob wordcount($s) token $s g a=0 foreach x in $s{ gl j=floor(runiform()*_n)+1 replace a=`$j' if word($s,_n)=`x' replace a=`x' if word($s,_n)=`$j' } l a,noo noh 

Expects input as space separated numbers. I can remove the headers and observation numbers from the output if you would like, but otherwise this is shorter.

STATA, 172

di _r(s) set obs wordcount($s) token $s g a=0 foreach x in $s{ gl j=floor(runiform()*_n)+1 replace a=`$j' if word($s,_n)=`x' replace a=`x' if word($s,_n)=`$j' } l a,noo noh 

Expects input as space separated numbers.

STATA, 161

di _r(s) set ob wordcount($s) token $s g a=0 foreach x in $s{ gl j=floor(runiform()*_n)+1 replace a=`$j' if word($s,_n)=`x' replace a=`x' if word($s,_n)=`$j' } l 

Expects input as space separated numbers. I can remove the headers and observation numbers from the output if you would like, but otherwise this is shorter.

make header work with leaderboard
Source Link
Martin Ender
  • 198.3k
  • 67
  • 455
  • 999

STATA 172

STATA, 172

di _r(s) set obs wordcount($s) token $s g a=0 foreach x in $s{ gl j=floor(runiform()*_n)+1 replace a=`$j' if word($s,_n)=`x' replace a=`x' if word($s,_n)=`$j' } l a,noo noh 

Expects input as space separated numbers.

STATA 172

di _r(s) set obs wordcount($s) token $s g a=0 foreach x in $s{ gl j=floor(runiform()*_n)+1 replace a=`$j' if word($s,_n)=`x' replace a=`x' if word($s,_n)=`$j' } l a,noo noh 

Expects input as space separated numbers.

STATA, 172

di _r(s) set obs wordcount($s) token $s g a=0 foreach x in $s{ gl j=floor(runiform()*_n)+1 replace a=`$j' if word($s,_n)=`x' replace a=`x' if word($s,_n)=`$j' } l a,noo noh 

Expects input as space separated numbers.

Source Link
bmarks
  • 2.1k
  • 11
  • 13

STATA 172

di _r(s) set obs wordcount($s) token $s g a=0 foreach x in $s{ gl j=floor(runiform()*_n)+1 replace a=`$j' if word($s,_n)=`x' replace a=`x' if word($s,_n)=`$j' } l a,noo noh 

Expects input as space separated numbers.