let transition_rule beta prng neighbourhoods =
let nb_neighbours_max = Array.fold_left (fun accu n -> max accu (Array.length n)) 0 neighbourhoods in
let probabilities = Array.init (2*nb_neighbours_max+1)
(fun i ->
let sum_neighbours = i-nb_neighbours_max in
barker (exp ~-.(2.*.beta*. float sum_neighbours))) in
fun configuration cell ->
let n = neighbourhoods.(cell) in
let sum_neighbours = ref 0 in
for i=0 to pred (Array.length n) do
if configuration.(n.(i)) then incr sum_neighbours else decr sum_neighbours;
done;
metropolis prng probabilities.(!sum_neighbours+nb_neighbours_max)