Be careful with this, but it helped a lot with a pony I had.
Take an empty plastic, disposable water bottle (one that is "crunchy" helps) and hold it in one hand while riding, if possible. Whenever she rears while you're on her, while she is up in the air hit her in the poll between her ears with the water bottle. It won't hurt, but they think that rearing up is no longer a way to get out of an uncomfortable situation. She will think that if she rears, her head will knock on something. I really hope this helps! Please let me know if it does!
When does she rear? Randomly? When she's doing something specific? Whenever she rears you need to make her do something that is really hard and tiring. Make her run in circles, move her hind in, anything and do it as soon as she has her feet on the ground. Make her think that rearing is hard because she's going to get punished for it. Just don't make her back up. Do not get off. Do not have her run forward.
Also talk to a trainer about it as a general tip.