magnetometer initializes to a random value between -180 and 180
It's not a random value, it's
based on direction of the imu.
If your question is
how should I set up this parameter initially.
Then you need to decide what you want it to be. Do you want zero to be whatever direction the robot is pointing when it's powered on, or do you want zero to be ...
In answer to your question the results do appear to be in degrees and unless you’ve entered a declination value then the results should point to magnetic north. If you’ve entered a declination offset for your local area then the magnetometer should point to true north.
In answer to your other question a magnetometer will be distorted by its local environment ...