It happen the same to my Ipad mini and I became crazy searching the answer. Annoying and frustrating! I allways thought it was a hacker, but it wasn't. Somehow I realized that all the problem started when I put a screen protector anti scratches on it. Since I removed it, problem fixed!!! Incredible, isn't it? It seems it affect the touch screen so it starts to type nonsense. No hardware problems, no Apple Stores visits: just remove the crap to protect it and it will work again.