diff --git a/celt/bands.c b/celt/bands.c
index 61ff188a01aa7d03971e3c13a8e17fb1962f369e..62f0ee731ae694928f18f8e7bfae2288540f14f7 100644
--- a/celt/bands.c
+++ b/celt/bands.c
@@ -1527,6 +1527,8 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end,
       /* Update the folding position only as long as we have 1 bit/sample depth. */
       update_lowband = b>(N<<BITRES);
    }
+   *seed = ctx.seed;
+
    RESTORE_STACK;
 }