#4176
vanilla
Assign every scroll and spellbook a random “writing difficulty” value at the start of the game. Say it’s stored as a percentage chance (in reality, this is an implementation detail and could differ). Every time you attempt to write a scroll or book, it computes your own percentage chance to correctly write something unknown, which is deterministic and only depends on stats like Luck and Intelligence and your role. Whether you write the scroll successfully or not depends on whether your computed percentage beats the randomized percentage of that scroll.