It depends on what kind of motor and other circuitry you have in your random orbital sander. But there are speed controllers for power tools (example of one here) that you can buy.
But you might be able to just buy a cheap buffer that is less than the speed controller.
These are used for speed control of routers https://www.amazon.com/Rockler-TATS-26-Router-Speed-Control/dp/B001DT4T4A/ref=sr_1_4?dchild=1&keywords=router+speed+control&qid=1598871652&sr=8-4