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:
Anonymous2021-01-30 0:25
puts (0..99).shuffle.join ','
Name:
Cudder!cXCudderUE2021-01-30 2:44
{~ ?~@# 1+i.?100,0
Name:
Anonymous2021-01-30 4:08
seq 0 99 | sort -R
Name:
Anonymous2021-01-30 4:11
Shortest wins? I forgot to use Cudder's awesome trick of ditching whitespace chars. seq 0 99|shuf
Name:
Anonymous2021-01-30 10:22
>>2 >>3 >>4,5 The programme terminates when the random number is zero. Those do not.
#include <stdio.h> #include <stdlib.h>//plain C version using stdlib rand() main(s){while(s)printf("%d,",s=rand()%100);}
Name:
Anonymous2021-01-30 15:26
for shell the shortest i've managed is 21 bytes: seq 1 99|shuf&&echo 0
Name:
Anonymous2021-01-30 15:28
#include <stdlib.h>//everything shell does is in C too main(){system("seq 1 99|shuf&&echo 0");}
Name:
Anonymous2021-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//
>>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:
Anonymous2021-01-31 9:22
>>22 It's not random if you know that the 100th number is always a zero.
Name:
Anonymous2021-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:
Anonymous2021-01-31 13:59
>>24 I can already see the design as too bloated due standard library.
Name:
Anonymous2021-01-31 17:36
>>24 Funny how it's still longer than the best PERL code.
Name:
Anonymous2021-01-31 18:27
10 LET N%=RND*100 20 PRINT N% 30 IF N<>0 THEN 10
Name:
Anonymous2021-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.