Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
[link http://perldoc.perl.org/functions/use.html][black][b]use[/b][/black][/link] [green]List::Util[/green] [red]qw/[/red][purple]shuffle[/purple][red]/[/red][red];[/red]
[link http://perldoc.perl.org/functions/my.html][black][b]my[/b][/black][/link] [blue]@pop[/blue] = [red]([/red][fuchsia]1..100[/fuchsia][red])[/red][red];[/red]
[black][b]my[/b][/black] [blue]$samples[/blue] = [fuchsia]30[/fuchsia][red];[/red]
[black][b]my[/b][/black] [blue]@sample[/blue] = [red]([/red][maroon]shuffle[/maroon][red]([/red][blue]@pop[/blue][red])[/red][red])[/red][red][[/red][fuchsia]0..[/fuchsia][blue]$samples[/blue]-[fuchsia]1[/fuchsia][red]][/red][red];[/red]
[link http://perldoc.perl.org/functions/print.html][black][b]print[/b][/black][/link] [red]"[/red][purple][blue]@sample[/blue][/purple][red]"[/red][red];[/red]
[link http://perldoc.perl.org/functions/my.html][black][b]my[/b][/black][/link] [blue]@pop[/blue] = [red]([/red][fuchsia]1..100[/fuchsia][red])[/red][red];[/red]
[black][b]my[/b][/black] [blue]$samples[/blue] = [fuchsia]30[/fuchsia][red];[/red][gray][i]# see note below[/i][/gray]
[black][b]my[/b][/black] [blue]@sample[/blue] = [maroon]rand_sample[/maroon][red]([/red][fuchsia]30[/fuchsia],[blue]@pop[/blue][red])[/red][red];[/red]
[link http://perldoc.perl.org/functions/print.html][black][b]print[/b][/black][/link] [red]"[/red][purple][blue]@sample[/blue][/purple][red]"[/red][red];[/red]
[link http://perldoc.perl.org/functions/sub.html][black][b]sub[/b][/black][/link] [maroon]rand_sample[/maroon] [red]{[/red]
[black][b]my[/b][/black] [red]([/red][blue]$n[/blue],[blue]@n[/blue][red])[/red] = [red]([/red][link http://perldoc.perl.org/functions/shift.html][black][b]shift[/b][/black][/link],[blue]@_[/blue][red])[/red][red];[/red]
[link http://perldoc.perl.org/functions/return.html][black][b]return[/b][/black][/link] [fuchsia]0[/fuchsia] [olive][b]unless[/b][/olive] [red]([/red][blue]$n[/blue] < [link http://perldoc.perl.org/functions/scalar.html][black][b]scalar[/b][/black][/link] [blue]@n[/blue][red])[/red][red];[/red][gray][i]# see note below [/i][/gray]
[black][b]my[/b][/black] [blue]%seen[/blue] = [red]([/red][red])[/red][red];[/red]
[olive][b]until[/b][/olive] [red]([/red][link http://perldoc.perl.org/functions/keys.html][black][b]keys[/b][/black][/link] [blue]%seen[/blue] == [blue]$samples[/blue][red])[/red] [red]{[/red]
[blue]$seen[/blue][red]{[/red][blue]$pop[/blue][red][[/red][link http://perldoc.perl.org/functions/rand.html][black][b]rand[/b][/black][/link] [blue]@pop[/blue][red]][/red][red]}[/red]=[fuchsia]1[/fuchsia][red];[/red]
[red]}[/red]
[black][b]return[/b][/black][red]([/red][black][b]keys[/b][/black] [blue]%seen[/blue][red])[/red][red];[/red]
[red]}[/red]