Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
docker
osticket
Commits
933420aa
Unverified
Commit
933420aa
authored
6 years ago
by
Peter Rotich
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #4174 from JediKev/issue/rand-number
oops: Fix randNumber()
parents
dfd49773
5b8b95ab
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/class.misc.php
+7
-5
7 additions, 5 deletions
include/class.misc.php
with
7 additions
and
5 deletions
include/class.misc.php
+
7
−
5
View file @
933420aa
...
...
@@ -52,12 +52,14 @@ class Misc {
}
/* Helper used to generate ticket IDs */
function
randNumber
(
$len
=
6
,
$start
=
false
,
$end
=
false
)
{
$start
=
(
!
$len
&&
$start
)
?
$start
:
str_pad
(
1
,
$len
,
"0"
,
STR_PAD_RIGHT
);
$end
=
(
!
$len
&&
$end
)
?
$end
:
str_pad
(
9
,
$len
,
"9"
,
STR_PAD_RIGHT
);
function
randNumber
(
$len
=
6
)
{
$number
=
''
;
for
(
$i
=
0
;
$i
<
$len
;
$i
++
)
{
$min
=
(
$i
==
0
)
?
1
:
0
;
$number
.
=
mt_rand
(
$min
,
9
);
}
return
mt_rand
(
$start
,
$end
)
;
return
(
int
)
$number
;
}
/* misc date helpers...this will go away once we move to php 5 */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment