Ask just about any developer and they will agree that cloning objects is a pretty standard practice. C++ has its copy constructors, …, and C# has it’s…ICloneable interface?
Okay, seriously, what is the deal with this thing? Is it supposed to perform a shallow copy, or a deep copy? Why doesn’t it output a cloned object that is strongly typed? Why is a half-completed interface a part of the .NET framework? Who allowed for this to be merged into the master branch? Does that person still have a job? Jokes aside, I am not the only one asking these questions. Do a simple Google search for the term “ICloneable” and you’ll find hundreds of thousands of questions all asking the same thing.
Continue reading “ICloneable: Why you should never use it.”
I constantly find myself needing pseudo-random numbers for machine learning projects. In most cases, the built-in .NET
Random class is perfect for this type of thing. For high-performance or type-specific application… not so much. It’s bad enough that
Random is limited to a handful of types. It’s even worse from a performance standpoint. For those who need to generate pseudo-random data hundreds of millions of times per second,
Random simply won’t cut it.
When implemented, XorShift+ is one of the fastest C# random number generator out there. It even passes the BigCrush statistics tests, meaning it generates a superb distribution of pseudo-random numbers.
Continue reading “Fastest C# Random Number Generator: XorShift+”