Skip to content
Snippets Groups Projects
  • Jan-Philipp Litza's avatar
    7cdf3708
    gluon-autoupdater: get random number from urandom · 7cdf3708
    Jan-Philipp Litza authored
    The approach with awk's rand() wasn't really random between across
    devices: When srand() was called without arguments, time() was used as
    seed, which of course is the same on all devices when the script is
    called via cron at HH:00:00.
    
    This patch instead uses /dev/urandom as source of random (we don't need
    cryptographically strong random numbers, so urandom is just fine) but
    still uses awk for the comparison as busybox's ash cannot deal with
    floats in $(())
    7cdf3708
    History
    gluon-autoupdater: get random number from urandom
    Jan-Philipp Litza authored
    The approach with awk's rand() wasn't really random between across
    devices: When srand() was called without arguments, time() was used as
    seed, which of course is the same on all devices when the script is
    called via cron at HH:00:00.
    
    This patch instead uses /dev/urandom as source of random (we don't need
    cryptographically strong random numbers, so urandom is just fine) but
    still uses awk for the comparison as busybox's ash cannot deal with
    floats in $(())