master
Bel LaPointe 2022-09-20 15:04:37 -06:00
parent dbff6792fa
commit 1da2d9fe9c
2 changed files with 5 additions and 0 deletions

View File

@ -54,3 +54,7 @@ class BucketChooserProportionalLogRandom:
1 + int(100 * math.log2(i[1])),
) for i in content
]
class BucketChooserProportionalRandom(BucketChooserProportionalLogRandom):
def xform(self, content):
return [(i[0], 1+int(100*i[1])) for i in content]

View File

@ -34,6 +34,7 @@ class TestBucketChoosers(unittest.TestCase):
def test_choosers(self):
for chooser in [
bucket.BucketChooserProportionalLogRandom(),
bucket.BucketChooserProportionalRandom(),
]:
with self.assertRaises(AssertionError):
self.assertRaises(chooser.choose([]))