iPad mini 4 restarts itself when shaken
This is definitely an hardware issue. The first thing I would suggest is to stop shaking it! :)
What ever loose connector you have there might stay loose which will force you to take it to apple \ local repair store.

I think it's better to take it for a repair now. I will be a lot easier for the repair guy to find the problem while it is still half working.