Timeline for How do I exit Vim?
Current License: CC BY-SA 3.0
22 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 21, 2017 at 13:23 | comment | added | musicman523 |
However in computer science, the representation format for floating point numbers is not infinite, meaning the range [0,1) is actually a discrete quantity. According to this StackOverflow answer, a number using IEEE754 format can represent 1023*2^52 numbers in the range [0,1) , which means the probability of selecting 0 is 1/(1023*2^52) . This is also discussed in this StackOverflow post.
|
|
Jun 21, 2017 at 13:20 | comment | added | musicman523 |
@mbomb007 Your suggestion of random()>0 brings about an interesting question. In mathematics, the probability of choosing any discrete quantity in a continuous range is 0 because, although it could at some point be chosen, there are an infinite number of such numbers, so the probability of each of them being chosen must be 0.
|
|
Jun 20, 2017 at 20:50 | comment | added | musicman523 |
@mbomb007 You don't need uniform randomness according to the challenge spec: each possibility has a non-zero probability of being chosen .
|
|
Jun 20, 2017 at 20:48 | comment | added | mbomb007 | I have a 47 byte answer if we don't need uniform randomness. | |
Jun 20, 2017 at 20:39 | comment | added | Artyer | @mbomb007 Huh. My mistake. | |
Jun 20, 2017 at 20:34 | comment | added | mbomb007 |
@Artyer You know what [0, 1) means, right? It means that zero is included because the range is zero-inclusive. stackoverflow.com/a/4396303/2415524 ...The easy way to remember it is that on a number line, closed dots are included, and open dots aren't. Brackets look closed, and parens look open.
|
|
Jun 20, 2017 at 17:09 | comment | added | mbomb007 |
Does the randomness have to be uniformly distributed? If not, you could do random()>0 , because there is a very very small chance that random() will return 0 .
|
|
Jun 20, 2017 at 15:40 | history | edited | totallyhuman | CC BY-SA 3.0 |
added 34 characters in body
|
Jun 20, 2017 at 15:39 | comment | added | totallyhuman | Ohh, that's clever. Thanks! | |
Jun 20, 2017 at 15:13 | comment | added | Artyer |
print'::qx!'[random()>.5:('N'in input(':q'))*5:2] saves three bytes
|
|
Jun 20, 2017 at 15:01 | history | edited | totallyhuman | CC BY-SA 3.0 |
added 4 characters in body
|
Jun 20, 2017 at 14:53 | history | edited | totallyhuman | CC BY-SA 3.0 |
added 83 characters in body
|
Jun 20, 2017 at 14:46 | history | edited | totallyhuman | CC BY-SA 3.0 |
added 35 characters in body
|
Jun 20, 2017 at 14:06 | history | edited | totallyhuman | CC BY-SA 3.0 |
added 37 characters in body
|
Jun 20, 2017 at 14:03 | comment | added | Rod |
random()>.5 to save a byte
|
|
Jun 20, 2017 at 13:59 | comment | added | Stephen |
@Mayube May we output a newline upon terminating? @Adám sure, that's fine
|
|
Jun 20, 2017 at 13:55 | history | edited | totallyhuman | CC BY-SA 3.0 |
deleted 7 characters in body
|
Jun 20, 2017 at 13:49 | comment | added | musicman523 |
This prints an extra newline where the challenge says it should not give any more output
|
|
Jun 20, 2017 at 13:45 | history | undeleted | totallyhuman | ||
Jun 20, 2017 at 13:45 | history | edited | totallyhuman | CC BY-SA 3.0 |
deleted 2 characters in body
|
Jun 20, 2017 at 13:40 | history | deleted | totallyhuman | via Vote | |
Jun 20, 2017 at 13:37 | history | answered | totallyhuman | CC BY-SA 3.0 |