Help for this page

Select Code to Download


  1. or download this
    constant RANGE = 10_000;
    my %hash = ^RANGE Z=> 0 xx RANGE;
    ...
    # Seen 10000 keys
    say "Average value (~100 if threadsafe): { %hash.values.sum / %hash.el
    +ems }";
    # Average value (~100 if threadsafe): 91.7143
    
  2. or download this
    constant RANGE = 10_000;
    my %hash is Bag = await do for 1..10 {
    ...
    # Seen 10000 keys
    say "Average value (~100 if threadsafe): { %hash.values.sum / %hash.el
    +ems }";
    # Average value (~100 if threadsafe): 100