original code
changed failing import (deprecated whrandom to random)