Add locking in acquire-random-range-id

This fixes a threadsafety issue documented in STORM-120. This is an
acceptable temporary fix, but the cause of concurrent access to this
variable should still be identified.

@revans2 suggested this fix.

Refs STORM-120