Timeline for Randomizing until 0
Current License: CC BY-SA 4.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 10, 2018 at 13:29 | comment | added | David Foerster |
With only 57 bytes you can amend your solution to use uniformly random numbers from random.randrange() : from random import*;f=lambda k:print(k)or f(randrange(k))
|
|
Jul 10, 2018 at 12:41 | comment | added | David Foerster |
The task requires a uniform random number from the given range. hash() tries to maintain but doesn't guarantee this property. For that task you should use the random module.
|
|
Jul 10, 2018 at 6:36 | comment | added | Jo King♦ | Sorry, but functions must be reusable arbitrarily often in the same environment. Terminating in an error is acceptable though | |
Jul 10, 2018 at 0:42 | comment | added | Luca Citi |
Notes: 1) the entry gives (usually) different results every time it's run in a new interpreter but may give the same result if run within the same python session. 2) I assume that terminating through an error without explicitly checking for k=0 is acceptable.
|
|
Jul 10, 2018 at 0:03 | history | answered | Luca Citi | CC BY-SA 4.0 |