The [ThreadStaticAttribute documentation page](https://learn.microsoft.com/en-us/dotnet/api/system.threadstaticattribute?view=net-9.0) speaks of random number generation and usage of `lock`, but the code of the example has nothing to do with it.