I want to generate a metal roughness map procedurally.
Solution from this video (but result tweaked for PBR roughness): https://youtu.be/MAecwsiu1xk
To generate a procedural roughness map you will first need to use a PBR shader, you will need the Principled BSDF shader in Blender 2.79, older versions don't have it. Also you will need an HDRI texture to see the result, you can find free HDRI online.
The Metal roughness must be dark to get very reflective and will use a noise texture to get little spots less reflective. To get a constant size and avoid seams visible you should an Input > Texture Coordinate in Object mode. Don't forget to apply the scale and rotation.
(image bellow of the node setup Attach the object input to a procedural noise texture, you can tweak the values, in this example I use a scale of 20 and detail at 2. Add a separate HSV, take the H (Hue) and mix it at 0.9 with the Object texture coordinate.
After the mix node add a second Noise texture with a scale of 10 and detail at 2. Then a color ramp to tweak the brightness of the texture. Move the cursor at 0.2 with a value of 0.248 and the right cursor at 0.8 with a value of 0.584. Connect it on the Principled BSDF texture.
You can bake a texture by attaching it to an emit shader then baking in emit mode to a low poly.