Problem: scheduler swaps current Env for the one before the last one
Problem: scheduler swaps current Env for the one before the last one

@dhardy noticed this https://github.com/PumpkinDB/PumpkinDB/pull/329
(thanks!) and it definitely doesn't make sense.

The original plan was to use the randomly chosen index.

Solution: use the index instead of `len - 1`

PumpkinDB/PumpkinDB