janky rand_rules implementation