Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

PROG CHALLENGE A NEW BEGINNING

Name: Anonymous 2021-01-29 21:35

Actual programming challenge:
Write a program that generates random numbers 0-99 incl and prints them to stdout using any fixed separator. It stops when it emits a 0 (zero).
Any distribution is ok as long as the numbers are not trivially predictable and each number has a provable nonzero weight.

Shortest program wins. No jerkoff languages. Deadline is 1feb2020 noon Z time.

Name: Anonymous 2021-01-30 0:25

puts (0..99).shuffle.join ','

Name: Cudder !cXCudderUE 2021-01-30 2:44

{~ ?~@# 1+i.?100,0

Name: Anonymous 2021-01-30 4:08

seq 0 99 | sort -R

Name: Anonymous 2021-01-30 4:11

Shortest wins? I forgot to use Cudder's awesome trick of ditching whitespace chars.
seq 0 99|shuf

Name: Anonymous 2021-01-30 10:22

>>2
>>3
>>4,5
The programme terminates when the random number is zero. Those do not.

Name: Anonymous 2021-01-30 11:21

t:100;r:(!t)@<t rand t;(r?0)#r

Name: Anonymous 2021-01-30 13:42

>>6

>>2-5
Optimized your quote for you

Name: Anonymous 2021-01-30 14:14

#include "Util/void.h"
main(){int s;while(print(s=rrange(0,100),","),s);}

Name: Anonymous 2021-01-30 14:23

#include "Util/void.h"//if a space is a valid separator then its shorter
main(){int s;while(print(s=rrange(0,100)),s);}

Name: Anonymous 2021-01-30 14:30

#include "Util/void.h"//44 chars if using some hacky reuse of argc and for loops
main(int s){for(;s;print(s=rrange(0,100)));}

Name: Anonymous 2021-01-30 14:35

#include "Util/void.h"//36 chars with %100 and defaulting int
main(s){for(;s;print(s=rnd()%100));}

Name: Anonymous 2021-01-30 14:50

>>10,11,12
How large is void.h? That counts towards the size.

Name: Anonymous 2021-01-30 15:11

Name: Anonymous 2021-01-30 15:16

#include <stdio.h>
#include <stdlib.h>//plain C version using stdlib rand()
main(s){while(s)printf("%d,",s=rand()%100);}

Name: Anonymous 2021-01-30 15:26

for shell the shortest i've managed is 21 bytes:
seq 1 99|shuf&&echo 0

Name: Anonymous 2021-01-30 15:28

#include <stdlib.h>//everything shell does is in C too
main(){system("seq 1 99|shuf&&echo 0");}

Name: Anonymous 2021-01-30 15:33

//seq accepts a single argument so it can be even shorter(19bytes shell and 38 C)
#include <stdlib.h>
main(){system("seq 99|shuf&&echo 0");}
seq 99|shuf&&echo 0//

Name: Anonymous 2021-01-30 15:34

//16 bytes shell, 35 C
echo $(seq 99) 0
#include <stdlib.h>
main(){system("echo $(seq 99) 0");}

Name: Anonymous 2021-01-30 15:35

echo $(seq 99|shuf) 0 //random 21

Name: Anonymous 2021-01-30 15:50

It stops when it emits a 0

Name: Cudder !cXCudderUE 2021-01-31 5:09

>>6,21
The output is exactly the same regardless of how you phrase it: a random number of random integers between 1 and 99 inclusive, followed by a 0.

Name: Anonymous 2021-01-31 9:22

>>22
It's not random if you know that the 100th number is always a zero.

Name: Anonymous 2021-01-31 13:40

I wrote the solution in my own programming language, I didn't write a compiler nor a spec yet but here's the code for your challenge:
progchall()

Name: Anonymous 2021-01-31 13:59

>>24
I can already see the design as too bloated due standard library.

Name: Anonymous 2021-01-31 17:36

>>24
Funny how it's still longer than the best PERL code.

Name: Anonymous 2021-01-31 18:27

10 LET N%=RND*100
20 PRINT N%
30 IF N<>0 THEN 10

Name: Anonymous 2021-01-31 20:13

1RANDOMIZE TIMER
2A%=RND*100:?A%:IF A% THEN 2

If producing the same numbers each time it runs isn't considered "trivially predictable", the first line can be removed.

Name: >>4 2021-02-01 4:08

>>6
haven't read the challenge, only the submissions. It's THEIR fault.
The programme terminates when the random number is zero.
fine.
seq 0 99|shuf|sed '/^0$/q'

Name: Anonymous 2021-02-01 4:30

M=Math
do{
n=M.floor(M.random()*100)
console.log(n)
}while(n)

Name: Anonymous 2021-02-01 4:36

shuf -i 0-99|sed '/^0/q' Edited on 01/02/2021 04:40.

Name: Anonymous 2021-02-01 9:47

>>23
seq 99|shuf|tail -n $(seq 10 30|tail -n 1)&&echo 0

Name: Anonymous 2021-02-01 9:50

>>32 if calc is installed its shorter
seq 99|shuf|tail -n $(calc "$RANDOM%100")&&echo 0

Name: Anonymous 2021-02-01 9:58

event shorter with some tricks
seq 99|shuf|tail -n $(calc $RANDOM%9)&&echo 0
or without the 'random N length'
seq 99|shuf|tail -9&&echo 0

Name: Anonymous 2021-02-01 18:27

DEADLINE ACHIEVED
WINNER IS >>22
FROZEN VOID

Name: Anonymous 2021-02-02 10:00

>>35
you mean >>18 -> seq 99|shuf&&echo 0

Name: Anonymous 2021-02-02 18:56

>>36
Yes sorry im autistic.
Grats @18

Name: Anonymous 2021-02-03 19:55


Don't change these.
Name: Email:
Entire Thread Thread List