Functioning of cover_group.sample() method?

I have a few questions regarding cover_group.sample() method.

1.Is it a task or a function?

2.Can anyone give me the implementation code for .sample() method? I know that whenever the line having the .sample method gets executed,it will sample the covergroup but what I need to know is what exactly happening when the .sample() method is called?

Thanks in advance
SATYA

In reply to SATYA369:

Section 19.8 Predefined coverage methods of the IEEE 1800-2017 LRM answers your questions.

In reply to dave_59:

Thanks dave

Regards
SATYA