Python 3 - 45 42 41 Bytes
41 bytes with the constraint of running from a different process every run.
print(f"Min{'ceec'[id(0)%4e4>1::2]}raft")
42 bytes with no contraintslimited randomness unless running a different process each time [*].
print(f"Min{'ceec'[id({})%4e4>1::2]}raft")
The idea was to use the same wrapper as in here, but a different RNG:
Create a new object (a set dict in this case, because it takes 5 2 characters set()
{}
), and take the id()
of that, which is its memory address.
The memory address acts like a uniform hash[*], which has 1/10000
1/40000
(thanks @ovs) chance to end with zeros.
Update to 42 bytes:
Instead of set()
, use {}
which is the dict
constructor. Can't go shorter for dynamic object creation.
Update to 41 bytes: - use static object creation!
Thanks to @dingledooper
Works only if the program is run in a different process every run!
Instead of {}
, use 0
.
0
is an object in Python, so it has an address in virtual memory, and that address is constant for that object during the lifetime of the program. If we were to run that in a for loop, it would not be random.
However, if we run it in a new process every run, we get the desired randomness. This is the case in a stateless server.
[*] - Objects in Python are freed immediately when they are no longer referenced (reference counting). Thus, running the solution in a loop might always output the same id, as the memory is freed and allocated at the same address. This is OS dependent, and environment dependent, thus may not work as expected, or in a reproducible way.
Running a new process each time solves this issue.