I very much like, and vigorously salute, the @FunTimes reply, and will just add my experiences as an adult life-long nocturnal cramps experience-er, whose wake up calls have been largely in remission for going on a year now:
They can be a moving target, just like our 'ol CH buddy. Magnesium citrate worked for me for keeping them at bay for like a couple years at one stretch, then failed. Magnesium gluconate seemed to help at one point also, but individuals apparently can have different reactions to different forms - citrate worsens cramps for one family member, but gluconate doesn't
Yep, the potassium-rich foods bananas, avocados, potatoes and sweet potatoes can potentially help significantly (at least until the target may shift)
I didn't realize the sudden wake up cramps could be anything other than a ridiculously huge emergency-feeling level of painful until more recently when I had a couple that were a strange and thoroughly unfamiliar kind of 'moderate'
I'm known to do occasional 'walking lunge' type leg exercises. Not sure what, if anything they're doing for me in the cramp department, but my current remission has coincided with the addition of this 'Advanced Electrolytes' supplement, one pill with dinner. I might question whether especially high doses of potassium are really required, but of course am fully acquainted with the desperate times/desperate measures mindset many of us here have been known to adopt courtesy of the CH!