You are here

function _uc_discounts_get_random_string in Ubercart Discounts (Alternative) 7.2

Same name and namespace in other branches
  1. 6.2 uc_discounts/uc_discounts.admin.inc \_uc_discounts_get_random_string()

Generates a random digit or letter, used as a callback for preg_replace.

1 string reference to '_uc_discounts_get_random_string'
uc_discounts_admin_generate_codes_form_submit in uc_discounts/uc_discounts.admin.inc
Submit handler for uc_discounts_generate_codes_form().

File

uc_discounts/uc_discounts.admin.inc, line 1524
Admin forms and functions for uc_discounts module.

Code

function _uc_discounts_get_random_string($matches) {

  // @see user_password
  $str = $matches[1] == 's' ? 'abcdefghijkmnopqrstuvwxyz' : '23456789';
  $str_len = strlen($str) - 1;
  return $str[mt_rand(0, $str_len)];
}