aboutsummaryrefslogtreecommitdiff
path: root/bin/rndi
blob: 3b0ea0056a5b8c23fd2267c050131d283cb53bf8 (plain) (blame)
1
2
3
4
5
6
7
8
9
#!/usr/bin/awk -f
# Get a low-quality random number between two integers. Note that depending on
# implementation, this might return the same number if run in the same second.
# It's only for trivial purposes.
BEGIN {
    srand()
    print int(ARGV[1]+rand()*(ARGV[2]-ARGV[1]+1))
    exit
}