# sf.apps.similarity.event_to_sample¶

event_to_sample(photon_number, max_count_per_mode, modes)[source]

Generates a sample selected uniformly at random from the specified event.

Example usage:

>>> event_to_sample(4, 2, 6)
[0, 1, 0, 0, 2, 1]

Parameters
• photon_number (int) – number of photons in the event

• max_count_per_mode (int) – maximum number of photons per mode in the event

• modes (int) – number of modes in the sample

Returns

a sample in the event

Return type

list[int]