Copied over randomization code

Most of it will remain the same. Still looking to change how things are
registered.