diff --git a/libavcodec/elbg.c b/libavcodec/elbg.c
index 35f068825f1c3450e588ec8884044b6a2aa379e8..85319db78e2be01873a8bf2f9585f9f8bb4d766e 100644
--- a/libavcodec/elbg.c
+++ b/libavcodec/elbg.c
@@ -105,7 +105,7 @@ static int get_high_utility_cell(elbg_data *elbg)
 {
     int i=0;
     /* Using linear search, do binary if it ever turns to be speed critical */
-    int r = av_lfg_get(elbg->rand_state)%(elbg->utility_inc[elbg->numCB-1]-1) + 1;
+    int r = av_lfg_get(elbg->rand_state)%elbg->utility_inc[elbg->numCB-1] + 1;
     while (elbg->utility_inc[i] < r)
         i++;