Skip to main content
1 of 2
The Matt
  • 281
  • 1
  • 5

Python 3, 51 bytes

Here is a few attempts at a python solution that use unorthodox random sources.

print(list(set(map(str,range(int(input())+1))))[0])

So to break this down.

int(input())+1

Gets the input number, and adds 1 to it.

set(range(...))

Creates the set {0, 1, 2, 3, 4, ... n} for all possible results.

print(list(...)[0])

Takes the set, converts it to list, and grabs the first item.

This works because in Python 3, the order of set() is established by PYTHONHASHSEED (can't be obtained but is established on script execution).

Admittedly, I am guessing that this is a uniform distribution, as the hash() value is randomly assigned and I am looking at randomly picking the value with a specific hash(), rather then just returning the hash(input()) itself.

If anyone knows whether this is a uniform distribution, or how I could test that, please comment.

The Matt
  • 281
  • 1
  • 5