I have a rather coarse vector map with polygons and want to calculate a (sufficiently) finer raster map defined by spatial extension and resolution. Every polygon of the vector map has a value associated that describes the percentage of pixels of the finer map inside the polygon that should be randomly set to 1. The fraction of pixels set to 1 should be as exact as possible.
Example: Polygon 7 is associated with a value of 20%. 50 pixels of the finer map would be (mainly) situated inside Polygon 7. Thus, 50*0.2=10 out of the 50 should be set to 1.
As a possible approach in GRASS, I found v.to.rast with use=cat to create a raster map from the polygons where the value indicates in which polygon they lie. Now, I would need to select randomly a percentage of the pixels with the same value.