Fixed massive bug in IWLS estimator, random seeding done once per call

Bug in IWLS estimator meant that beta was not being calculated resultin in skewed estimates.
Random seeding now done in the top level rather than lower down so that multiple function generations in the same call do not end up looking the same.