1. A method of comparing a first pattern (A) represented by a first ordered set of elements (X j ) each having a value with a second pattern (B) represented by a second ordered set of element (u,) each having a value, comprising iteratively performing the steps of: (i) selecting a plurality of elements from the first ordered set (ii) for each selected element of the first ordered set, selecting an element from the second ordered set, such that the selected elements of the second ordered set have, within the second ordered set, a set of positional relationships relative to each other that is the same as, or a transformation of, the set of positional relationships that the selected plurality of elements of the first ordered set have relative to each other; (iii) determining whether the selected elements meet the match criterion; and (iv) in the event of a match, updating at least one similarity score (S AB ); characterised by, on each iteration, generating a random shift value (γ), and in that the match criterion is that the value of each of the selected elements of the first ordered set differs from the value of the correspondingly positioned selected element of the second ordered set by an amount that is equal to, or within a set margin of, and in the same sense as, said shift value,