| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Returns true if |toTest| contains only digits. Leading and trailing | 6 * Returns true if |toTest| contains only digits. Leading and trailing |
| 7 * whitespace is allowed. | 7 * whitespace is allowed. |
| 8 * @param {string} toTest The string to be tested. | 8 * @param {string} toTest The string to be tested. |
| 9 */ | 9 */ |
| 10 function isInteger(toTest) { | 10 function isInteger(toTest) { |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 * |endPointB| are included. | 196 * |endPointB| are included. |
| 197 * @param {number} endPointA One end of the desired range. | 197 * @param {number} endPointA One end of the desired range. |
| 198 * @param {number} endPointB The other end of the desired range. | 198 * @param {number} endPointB The other end of the desired range. |
| 199 * @return {number} The random integer. | 199 * @return {number} The random integer. |
| 200 */ | 200 */ |
| 201 function randomInteger(endPointA, endPointB) { | 201 function randomInteger(endPointA, endPointB) { |
| 202 from = Math.min(endPointA, endPointB); | 202 from = Math.min(endPointA, endPointB); |
| 203 to = Math.max(endPointA, endPointB); | 203 to = Math.max(endPointA, endPointB); |
| 204 return Math.floor(Math.random() * (to - from + 1) + from); | 204 return Math.floor(Math.random() * (to - from + 1) + from); |
| 205 } | 205 } |
| 206 |
| 207 // Number of points per inch. |
| 208 POINTS_PER_INCH = 72; |
| 209 |
| 210 /** |
| 211 * Converts |value| from inches to points. |
| 212 * @param {number} value The number in inches. |
| 213 * @return {number} |value| in points. |
| 214 */ |
| 215 function convertInchesToPoints(value) { |
| 216 return value * POINTS_PER_INCH; |
| 217 } |
| 218 |
| 219 /** |
| 220 * Converts |value| from points to inches. |
| 221 * @param {number} value The number in points. |
| 222 * @return {number} |value| in inches. |
| 223 */ |
| 224 function convertPointsToInches(value) { |
| 225 return value / POINTS_PER_INCH; |
| 226 } |
| OLD | NEW |