Inclusion Criteria:
* HRR gene alteration (as identified by the sponsor's required assays) as follows:
1. Cohort 1: positive for HRR gene alteration
2. Cohort 2: not positive for DRD (that is, HRR gene alteration)
3. Cohort 3: eligible by HRR status
* Metastatic disease documented by positive bone scan or metastatic lesions on computed tomography (CT) or magnetic resonance imaging (MRI)
* Metastatic prostate cancer in the setting of castrate levels of testosterone less than or equal to (<=) 50 nanogram per deciliter (ng/dL) on a gonadotropin releasing hormone analog (GnRHa) or bilateral orchiectomy
* Able to continue GnRHa during the study if not surgically castrate
* Score of <= 3 on the brief pain inventory-short form (BPI-SF) question number 3 (worst pain in last 24 hours)
Exclusion Criteria:
* Prior treatment with a poly (adenosine diphosphate [ADP]-ribose) polymerase (PARP) inhibitor
* Systemic therapy (that is, novel second-generation AR-targeted therapy such as enzalutamide, apalutamide, or darolutamide; taxane-based chemotherapy, or more than 4 months of abiraterone acetate plus prednisone [AAP] prior to randomization) in the metastatic castration-resistant prostate cancer (mCRPC) setting; or AAP outside of the mCRPC setting
* Symptomatic brain metastases
* History or current diagnosis of myelodysplastic syndrome (MDS)/acute myeloid leukemia (AML)
* Other prior malignancy (exceptions: adequately treated basal cell or squamous cell skin cancer, superficial bladder cancer, or any other cancer in situ currently in complete remission) <= 2 years prior to randomization, or malignancy that currently requires active systemic therapy