New answers tagged

0 votes

Generate a Tiefling's Traits

MathGolf, 17 14 bytes mÅvαá├mÅ~;3w⌠< Try it online. I really hate this language sometimes.. -_- This should in theory have been ...
0 votes

Generate a pronounceable word

Japt, 20 bytes ;`Á<` 5ÆCkU ö +Uöì Note that there is an unprintable character in front of the Á Test it ...
2 votes

Generate a pronounceable word

"Random Word Generator", 70 +2 = 72 bytes C=b c d f g h j k l m n p q r s t v w x z V=a e i o u y syllable:$C$V Set minimum and maximum number of ...
  • 3,583
0 votes

Generate a Tiefling's Traits

APL (Dyalog Unicode), 23 bytes (15 chars) {⍵[(≢⍵)?⍨1+?4]} Explanation: ...
  • 383
1 vote

Generate a pronounceable word

K (ngn/k), 57 47 bytes (Not competitve, yet) {""/{(1?"bcdfghjklmnpqrstvwxz"),1?"aeiouy"}'!5} Try it online! Not particularly concise, ...
  • 753
2 votes

Sample from the discrete triangular distribution

Python, 57 bytes lambda n:max(r(1,n),r(n)) from random import* r=randrange Attempt This Online! Python, 60 bytes ...
  • 9,418
0 votes

Sample from the discrete triangular distribution

C (gcc), 43 bytes f(n){n=sqrt(2*(rand()/21e8*n*++n/2)+1)-.5;} Try it online!
  • 2,347
2 votes

Sample from the discrete triangular distribution

Python, 71 bytes lambda x:x-abs((a:=r(x)-r(x+1))+(a>=0)) from random import* r=randrange Attempt This Online! Surprisingly tricky. Uses the fact that the sum of ...
  • 2,961
4 votes

Sample from the discrete triangular distribution

JavaScript (ES7), 37 bytes -1 thanks to @Neil n=>(Math.random()*n*-~n+1|0)**.5+.5|0 Try it online! How? We essentially pick a random integer in \$\left[1\dots\...
  • 171k
1 vote

Sample from the discrete triangular distribution

Charcoal, 14 bytes I⌊⁺·⁵₂⊕‽X⁺·⁵N² Try it online! Link is to verbose version of code. Explanation: ...
  • 148k
1 vote

Sample from the discrete triangular distribution

R, 46 bytes function(n)((1+4*runif(1)*n*(n+1))^.5-1)%/%2+1 Try it online! runif(1) calculates a random number from the uniform ...
0 votes

Randomizing until 0

MathGolf, 4 bytes orw∟ Try it online. Explanation: ...
2 votes

Randomizing until 0

Vyxal M, 4 bytes {℅…| Try it Online! the M flag generates a range 0-n implicitly ...
2 votes

Generate a Tiefling's Traits

PowerShell, 25 bytes Input comes from the pipeline. random -c(random -mi 2 6) Try it online! Ungolfed: ...
2 votes

Generate a Tiefling's Traits

Excel (ms365), 52 bytes =TAKE(SORTBY(A1:A12,RANDARRAY(12)),RANDBETWEEN(2,5))
  • 311
3 votes

Generate a Tiefling's Traits

Bash + coreutils, 20 shuf -n$[RANDOM%4+2] Try it online!
1 vote

Generate a Tiefling's Traits

05AB1E, 7 bytes .rY5ŸΩ£ Very straight-forward, but can't find anything shorter. (I initially read the challenge description wrong as 1-4 random outputs, which ...
4 votes

Generate a Tiefling's Traits

Japt, 6 5 7 bytes ö¬o2+4ö Try it ...
  • 36k
4 votes

Generate a Tiefling's Traits

Goruby, 16 bytes ->a{a.s rn 2..5} Attempt This Online! Ruby, 23 bytes ->a{a.sample rand 2..5} Attempt This Online!
  • 5,995
5 votes

Generate a Tiefling's Traits

Raku, 18 bytes *.pick(pick 2..5:) Try it online! pick 2..5: picks a random number from 2 to 5, then gives that as an argument ...
  • 6,036
7 votes

Generate a Tiefling's Traits

Factor + dice, 22 bytes [ ROLL: 1d4+1 sample ] Try it online! A quotation (anonymous function) that takes a list of strings as ...
  • 11.8k
5 votes

Generate a Tiefling's Traits

Jelly,  7  6 bytes Ẋṫ4XN¤ A monadic Link that accepts a list of lists of characters and yields another with 2-5 random entries. Try it online! How? ...
4 votes

Generate a Tiefling's Traits

Python (Full program), 58 bytes -1 byte thanks to @The Fifth Marshal from random import*;print(sample([*open(0)],randint(2,5))) Attempt This Online! Python (...
  • 2,961
5 votes

Generate a Tiefling's Traits

Retina, 22 bytes ?O` ,3G`¶ ?&0A`¶ ?&0A` Try it online! Explanation: ?O` Uniformly shuffle the input. ...
  • 148k
2 votes

Generate a Tiefling's Traits

Charcoal, 21 bytes WS⊞υι≔⟦⟧θF⁺²‽⁴⊞θ‽⁻υθθ Try it online! Link is to verbose version of code. Explanation: WS⊞υι Read in the ...
  • 148k
0 votes

Generate a pronounceable word

C (gcc), 63 bytes c;f(n){for(n=10;n;81192%c-n&1||putchar(c,n--))c=97+clock()%26;} Try it online!
  • 2,347
0 votes

Write some Random English

Raku, 67 bytes {$!=<a e i o u>;({(('a'..'z')∖$!,$!)[$++%2].pick}...*)[^$_].join} Try it online! The vowels are stored in ...
  • 6,036
0 votes

Write some Random English

C (gcc), 61 58 bytes c;f(n){for(;n;4370%c-n&1&&putchar(c,n--))c=97+clock()%26;} Try it online! -3 bytes thanks to ceilingcat!!
  • 2,347
0 votes

Write some Random English

Pyth, 19 bytes J"aeiou"smO?%d2J-GJ Test suite Explanation: ...
  • 4,191
1 vote

Write some Random English

Jelly, 9 8 bytes ØḄØẹḂ?X) -1 byte thanks to @Steffan Try it online! Explanation: ...
1 vote

10 PRINT CHR$(205.5+RND(1)); : GOTO 10 in PHP (or anything else, for that matter)

Mathematica - 36 Bytes Barebones with no formatting. I don't know why the slashes are different thickness Grid@RandomChoice[{"/","\\"},5{8,5}]
0 votes

10 PRINT CHR$(205.5+RND(1)); : GOTO 10 in PHP (or anything else, for that matter)

Rust, 143 bytes, std only ...
  • 3,583
1 vote

10 PRINT CHR$(205.5+RND(1)); : GOTO 10 in PHP (or anything else, for that matter)

Go, 78 bytes (fixed seed) package main import."math/rand" func main(){for{print(string(`/\`[Intn(2)]))}} Attempt This Online! Prints to STDERR. Random ...
  • 3,583
1 vote

10 PRINT CHR$(205.5+RND(1)); : GOTO 10 in PHP (or anything else, for that matter)

Python, 66 bytes import random while 1:print(chr(47+random.randint(0,1)*45),end='') Try it online! Ungolfed: ...
  • 383
1 vote

Shortest code to produce non-deterministic output

SNOBOL4 (CSNOBOL4), 15 14 bytes I got a hint from user62131's sh + procps answer. exit('w') end Try it online!
1 vote

As close to flat as possible

Pyth, score of the order \$f_{\varphi(\omega,0)+1}(10^{10^{64}})^{-1}\$ ...
  • 121
0 votes

Produce n n-squares of integers with rotating *'s in consecuitive corners

Husk, 19 17 bytes* (* caveat: validity (or not) depends on the interpretation of 'pseudo-random integers'...) T↑¹¡oT↔↑¹C:'*ṁsİπ Try it online! Digits within each ...
1 vote

Produce n n-squares of integers with rotating *'s in consecuitive corners

Japt -R, 20 19 bytes I could save a byte by either filling each square with the same random digit but ƲÆAöìh* òU zXÃÕm¸ Try ...
  • 36k
0 votes

Produce n n-squares of integers with rotating *'s in consecuitive corners

05AB1E, 27 bytes иLdć'*0ǝšIGDøí})øJ»εDižhΩ]J Try it online or verify multiple dimensions. Explanation: Step 1: Create a matrix of the input by input amount of <...

Top 50 recent answers are included