How to know if my ruptured bloody cyst was a functional ovarian cyst or endometriosis? Is there a way to distinguish between both of them?

No. Only surgery and pathologically looking at the cyst can tell you. If your ca -125 level in the blood is high then that suggests endometriosis.
Difficult. This can but challenging. Both can look the same on ultrasound, but functional cysts are more often clear (black) as opposed to heterogeneous (white). Often times functional cysts after they rupture-leak will not reoccur endometiromas will remain and re-expand. Sometimes a blood ca-125 may be useful.