I had code using math.random() to generate passwords introduced into my codebase, written by opus 4.6 in Febuary 2026, and not found until November 2026
Lots of old examples of code using Math.random() in the training data, probably more than Crypto.getRandomValue, given that Math.random has been around a lot longer.
You can try and train it out afterwards but there’ll always be a part of the model that wants to write everything with Math.random because so many people did in the past