for deterministic case