retrieve randomly generated variable in a postman collection

You can just add this to the Tests script of the first request:

pm.collectionVariables.set('id', pm.response.json().id)

This will set a new id variable each time you hit send, this can be used in the next request.