So I came across this question on SO, but none of the answers really focus on forcing crashes in the shortest amount of characters. So, my question is, what is the shortest way, using the least number of characters, to crash an iOS application?
Either a Swift or Obj-C solution would be fine. The...
@Dennis Well, array += [1] is just shorthand for array = array + [1], and when you do array + [1], a new list is created, and this is then assigned to array. If array is not local, then this should fail because you're trying to assign to something out of scope. On the other hand, array.append(1) works in-place. It's like sorted(array) versus array.sort().
Good news everyone, it was discussed on the Stack Exchange podcast, and we now have a site design. This should be rolling out as soon as we can get the design spec converted into workable CSS.
Completed layout:
If you have any comments before this is finalized, please let me know.
Design con...
No real-world car can accelerate faster than $5g$, so the maximum acceleration of the car is under $50m/s^2$. Even if the car instantly decelerates (against a wall or something), the fact that $P$ can do the trip in $1$ second means that $A$ and $B$ are at most $25m$ apart (more realistically $1m...
Where should I put my mirror?
code-golf string palindrome
This is a mirror: |. I just found out that you can stick a mirror in the middle of a string if the string can be mirrored on itself! For example, the string abccba. If you cut it in half the two halves are mirror images of each other:
...
@El'endiaStarman That's not true. Appending to an array, even with +=, does not create a new array. (I really should say list, since it's different for tuples.)
>>> x = [1, 2, 3]
>>> y = x
>>> x += [4]
>>> x
[1, 2, 3, 4]
>>> y
[1, 2, 3, 4]
>>> x = x + [5]
>>> x
[1, 2, 3, 4, 5]
>>> y
[1, 2, 3, 4]
Inspiration.
Task
Reverse sequences of odd numbers in a given list of 2 to 215 integers between 0 and 215.
Rules
Input and output must be numeric in the sense that further numeric computation (e.g. adding 2) would be possible.
Examples
0 1 → 0 1
1 3 → 3 1
1 2 3 → 1 2 3
1 3 2 → 3 1 2
10 7 ...
How can I convert a long integer (as a string) to a numerical format in Javascript without javascript rounding it?
var ThisInt = '9223372036854775808'
alert(ThisInt+'\r' +parseFloat(ThisInt).toString()+'\r' +parseInt(ThisInt).toString());
I need to perform an addition on it before casting it b...
The United Nations officially condemned the practice of countries shutting down access to the internet. A resolution (PDF) entitled The promotion, protection and enjoyment of human rights on the Internet effectively extends human rights held offline to the internet. It was passed by consensus, but only after a determined effort by a number of countries, including China and Russia, to pull out key parts of the text.
Blum Blum Shub (B.B.S.) is a pseudorandom number generator proposed in 1986 by Lenore Blum, Manuel Blum and Michael Shub that is derived from Michael O. Rabin's oblivious transfer mapping.
Blum Blum Shub takes the form
x
n
+
1
=
x
n
2
mod
M
{\displaystyle x_{n+1}=x_{n}^{2}{\bmod {M}}}
,
where M = pq is the product...
> The two primes, p and q, should both be congruent to 3 (mod 4) (this guarantees that each quadratic residue has one square root which is also a quadratic residue)...
> For a given positive integer n {\displaystyle n} n, two integers a {\displaystyle a} a and b {\displaystyle b} b are called congruent modulo n {\displaystyle n} n, written
a ≡ b ( mod n ) {\displaystyle a\equiv b{\pmod {n}}} a \equiv b \pmod{n}
if a − b {\displaystyle a-b} a-b is divisible by n {\displaystyle n} n...
@thepiercingarrow Because I'm angered somehow. The last time I left chat was in a scandal where I was invited twice (!) yesterday to the Trash, by El'endia Starman.
@Maltysen Cycle length testing my RNG on the seed 2, I got 3 prompts to stop the "not responding" script, the last of which I stopped the script. But I also got a result of 1647228+.
Therefore, the cycle length is definitely large.
And finally, refactor that into an object and factory of such objects.
Such that the functions in one object are independent of other objects and there can be multiple states of the generator.
I made a Blum Blum Shub pseudorandom number generator implementation in JavaScript.
Blum Blum Shub (B.B.S.) is a pseudorandom number generator proposed in
1986 by Lenore Blum, Manuel Blum and Michael Shub that is derived
from Michael O. Rabin's oblivious transfer mapping.
Blum Blum S...
Write some code to do the following:
Take two inputs:
a signed number in either decimal or octal
the number of bits of precision (greater than 0), expressed in decimal
If the number is out of range of the number of bits, throw an error, return NaN or overflow or whatever is most appropriate ...
@Bálint I might consider it. But I cant count on functions being in a language, so I probably wont. It's really for a new esolang I'm coming up with. Really fun one.
@CᴏɴᴏʀO'Bʀɪᴇɴ El'endia Starman, who invited me, non-guilty, in the Trash twice yesterday, has entered the depths of the user list as a ghost. Don't worry, all is good. ;)
Minecraft 1.10, 221 characters (non-competing)
See, this is what we have to deal with when we make Minecraft maps.
Aside: There's no way to take a string input in Minecraft, so I'm cheating a bit by making you input the numbers into the program itself. (It's somewhat justifiable because quite a...
@CᴏɴᴏʀO'Bʀɪᴇɴ carry in/out, used for chaining the circuits iirc
Fuzzy Octo Guacamole, 1 byte
a
A function that takes inputs from the top of the stack and outputs by pushing to the stack.
Example running in the REPL:
>>> 8 9 :
[8,9]
>>> a :
17
@zʏᴀʙiɴ101 Once again, the SE chat system is the one that invites you to any room that you've had a message (or messages) moved to. I simply cleaned up a couple pointless/noisy sequences of messages, which your message(s) happened to be part of, either contributing or in response. I couldn't just leave a response to moved messages here because it wouldn't make sense, so I moved responses as well. Don't take it so personally.
GoLScript, 1 byte (non-competiting)
K
Adds the top 2 numbers on the stack. That's it.
Now how to push them on to the stack, I have no clue. I don't think it's possible.. cough @CᴏɴᴏʀO'Bʀɪᴇɴ cough