Generating a random list of materials and a given property

I’d like to generate a list of formulas from MP and their associated bandgaps. I am not specific about the material type or domain. I suggest need a substantial number of (material, property) pairs. What is the best way of doing this?

So let’s say that all I need is a list of 1000 records of the form [“material_id”,“formula_pretty”,"band_gap”])

Is there a way of doing this efficiently?