
zufällig
by chance
Happening by chance; not planned or intended.
Ich habe meine alte Schulfreundin zufällig im Supermarkt getroffen.
I ran into my old school friend by chance at the supermarket.
random / by chance
Loading your saved state.

by chance
Happening by chance; not planned or intended.
Ich habe meine alte Schulfreundin zufällig im Supermarkt getroffen.
I ran into my old school friend by chance at the supermarket.

by any chance
Used as an adverb in a question to make it more polite or less direct, similar to 'perhaps' or 'possibly'.
Wissen Sie zufällig, wie spät es ist?
Do you happen to know what time it is?

random
In mathematics and statistics: based on the principle of chance; stochastic.
Die Auswahl der Teilnehmer für die Studie erfolgte nach einem zufälligen Verfahren.
The participants for the study were selected using a random procedure.
The word 'zufällig' (random/by chance) is derived from the noun 'der Zufall' (chance/coincidence). A 'Zufall' is an event that is not planned. So when something happens 'zufällig' (by chance), it happens 'durch Zufall' (by chance).
Was für ein Zufall, dass wir uns hier treffen!
What a coincidence that we're meeting here!
As an adverb, 'zufällig' (by chance/by any chance) can stand flexibly in the sentence. It often stands directly after the conjugated verb or at the beginning of the sentence to emphasize that the event was unplanned.
Ich habe zufällig noch ein Ticket übrig.
I happen to have one ticket left.
In questions, 'zufällig' (by any chance) is used to make the question more indirect and polite. It signals that you understand the other person may not know the answer.
Haben Sie zufällig einen Stift für mich?
Do you happen to have a pen for me?
In the meaning 'unbeabsichtigt' (unintentional/by chance), 'zufällig' (by chance) is often combined with verbs of perception or encounter. Typical are: 'jemanden zufällig treffen' (to meet someone by chance), 'etwas zufällig sehen' (to see something by chance), or 'etwas zufällig hören' (to hear something by chance).
Beim Spaziergang habe ich zufällig einen alten Freund getroffen.
On my walk, I met an old friend by chance.
The meaning 'stochastisch' (stochastic) belongs to the technical language of mathematics and statistics. In everyday language, 'zufällig' (random) is almost never used in this exact sense.
Die Testgruppe wurde durch eine zufällige Auswahl bestimmt.
The test group was determined through random selection.
maybe
In polite questions, both „vielleicht“ and „zufällig“ can soften the wording. „Vielleicht“ generally makes the request more tentative; „zufällig“ additionally asks whether a convenient opportunity has just arisen or whether the person happens to have something available.

Haben Sie zufällig einen Stift dabei?
Do you happen to have a pen with you?
Haben Sie vielleicht einen Stift für mich?
Do you perhaps have a pen I could use?