Random access in the IoT: An adaptive sampling and transmission strategy