Atelier des rouesLab FR
Objects/Documentation

flux18.py

Amortize a histogram · Reproducible Python implementation.

Download ↓
"""Byte-level fixed-weight binary block stream with one histogram per group."""
import json
from math import comb


def unrank(n,k,r):
    word=0
    for j in reversed(range(n)):
        first=comb(j,k) if k<=j else 0
        if r>=first:
            word|=1<<j
            r-=first
            k-=1
    return word

Read in context

Comments

Comments from both language editions appear here.

The discussion is open for reading. I’ll enable submissions once spam protection is configured.