rand() question

From: daniel kaplan (nospam_at_nospam.com)
Date: 09/15/04


Date: Tue, 14 Sep 2004 20:58:25 -0400

so i generate a serial number with the exact code below (three lines):

$number1 = 10000 + int(rand(99999));
$number2 = 10000 + int(rand(99999));
$shrwsn = "$number1-$number2";

the point is i want TWO five digit numbers separated by a dash "-"
and all is cool, but i just noticed, that for the three entries i have made
test wise:

79109-72626
106421-1023 these last two are six and four digits.....
108629-3542

WHY? these were all made with the SAME script...............



Relevant Pages

  • rand() question
    ... so i generate a serial number with the exact code below: ... the point is i want TWO five digit numbers separated by a dash "-" ...
    (comp.lang.perl.misc)
  • Re: How can I replace this complex string?
    ... Three posts within three minutes is two too many and not enough time for ... That will look for any digit, any digit, any ... digit, white space, dash, white space and delete it. ...
    (microsoft.public.word.docmanagement)
  • Re: Zip Code Validation - length =5 or 9
    ... the users don't have to worry about the dash ... Custom/Special/ZipCode formatting because 12345 would enter as a number ... the OP almost had to be formatting his column as Text. ... the validation to only allow a 5 digit or 9 digit value? ...
    (microsoft.public.excel.misc)
  • Re: Mildly annoying import glitch
    ... ;Check digit including the number system digit ... The above code allows you to verify the UPC check digit is correct ... A language accompanies this either side of the dash thing - "the ... enter a sale into our app, UPCs are converted back to 10 continuous chars, ...
    (comp.databases.paradox)
  • Re: Help another zipcode delimma
    ... Why are you allowing them to enter a 6 digit zip? ... You wonder why the zip code is stored with a dash also. ... I want to say give me all the zips that are 5 and 6 digits and where ... I have made a seprate query for the 10 digit. ...
    (comp.databases.oracle.misc)