function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

How to create this while using apex?

It is necessary to design an algorithm (a functional class in Apex) which will receive a list of contacts. A percentage will determine the number of people from the list to whom an email will be sent. This percentage should be able to be changed later by an admin dynamically without the need to change the code.

The important thing is that for each possible execution of the class, the list of contacts must be shuffled and sorted randomly. After the list is arranged, by percentage, the total number of contacts to be sent by email must be selected. Each sequence must be different for each execution.
PriyaPriya (Salesforce Developers) 

The developer community recommends providing any attempts/code you've started, any errors you're getting, or where exactly you're struggling in achieving this while posting a question.

Thanks & regards,

Priya Ranjan