Skip to main content
added 56 characters in body
Source Link
Gulzar
  • 261
  • 2
  • 9

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.

Try it online!

Update to 42 bytes:
Instead of set(), use {} which is the dict constructor. Can't go shorter for dynamic object creation.

Try it online!

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.

Try it online!

[*] - 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.

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 with no contraints [*].

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.

Try it online!

Update to 42 bytes:
Instead of set(), use {} which is the dict constructor. Can't go shorter for dynamic object creation.

Try it online!

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.

Try it online!

[*] - 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.

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 limited 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.

Try it online!

Update to 42 bytes:
Instead of set(), use {} which is the dict constructor. Can't go shorter for dynamic object creation.

Try it online!

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.

Try it online!

[*] - 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.

added 4 characters in body
Source Link
Gulzar
  • 261
  • 2
  • 9

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 with no contraints [*].

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.

Try it online!

Update to 42 bytes:
Instead of set(), use {} which is the dict constructor. Can't go shorter for dynamic object creation.

Try it online!

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.

Try it online!

[*] - 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.

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 with no contraints.

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.

Try it online!

Update to 42 bytes:
Instead of set(), use {} which is the dict constructor. Can't go shorter for dynamic object creation.

Try it online!

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.

Try it online!

[*] - 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.

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 with no contraints [*].

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.

Try it online!

Update to 42 bytes:
Instead of set(), use {} which is the dict constructor. Can't go shorter for dynamic object creation.

Try it online!

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.

Try it online!

[*] - 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.

added 393 characters in body
Source Link
Gulzar
  • 261
  • 2
  • 9

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 with no contraints.

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 hashhash[*], which has 1/10000 1/40000 (thanks @ovs) chance to end with zeros.

Try it online!

Update to 42 bytes:
Instead of set(), use {} which is the dict constructor. Can't go shorter for dynamic object creation.

Try it online!

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.

Try it online!

[*] - 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.

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 with no contraints.

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.

Try it online!

Update to 42 bytes:
Instead of set(), use {} which is the dict constructor. Can't go shorter for dynamic object creation.

Try it online!

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.

Try it online!

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 with no contraints.

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.

Try it online!

Update to 42 bytes:
Instead of set(), use {} which is the dict constructor. Can't go shorter for dynamic object creation.

Try it online!

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.

Try it online!

[*] - 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.

added 3 characters in body
Source Link
Gulzar
  • 261
  • 2
  • 9
Loading
Rollback to Revision 7
Source Link
Gulzar
  • 261
  • 2
  • 9
Loading
deleted 139 characters in body; deleted 43 characters in body; added 72 characters in body
Source Link
Gulzar
  • 261
  • 2
  • 9
Loading
added 883 characters in body
Source Link
Gulzar
  • 261
  • 2
  • 9
Loading
added 29 characters in body
Source Link
Gulzar
  • 261
  • 2
  • 9
Loading
added 114 characters in body
Source Link
Gulzar
  • 261
  • 2
  • 9
Loading
added 114 characters in body
Source Link
Gulzar
  • 261
  • 2
  • 9
Loading
added 15 characters in body; added 14 characters in body; added 2 characters in body
Source Link
Gulzar
  • 261
  • 2
  • 9
Loading
edited body
Source Link
Gulzar
  • 261
  • 2
  • 9
Loading
Source Link
Gulzar
  • 261
  • 2
  • 9
Loading