RandomUtils.html 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <!-- NewPage -->
  3. <html lang="en">
  4. <head>
  5. <!-- Generated by javadoc (1.8.0_131) on Sat May 27 07:28:13 EDT 2017 -->
  6. <title>RandomUtils</title>
  7. <meta name="date" content="2017-05-27">
  8. <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
  9. <script type="text/javascript" src="../../../../script.js"></script>
  10. </head>
  11. <body>
  12. <script type="text/javascript"><!--
  13. try {
  14. if (location.href.indexOf('is-external=true') == -1) {
  15. parent.document.title="RandomUtils";
  16. }
  17. }
  18. catch(err) {
  19. }
  20. //-->
  21. var methods = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9,"i6":9,"i7":9,"i8":9,"i9":9,"i10":9,"i11":9,"i12":9};
  22. var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"]};
  23. var altColor = "altColor";
  24. var rowColor = "rowColor";
  25. var tableTab = "tableTab";
  26. var activeTableTab = "activeTableTab";
  27. </script>
  28. <noscript>
  29. <div>JavaScript is disabled on your browser.</div>
  30. </noscript>
  31. <!-- ========= START OF TOP NAVBAR ======= -->
  32. <div class="topNav"><a name="navbar.top">
  33. <!-- -->
  34. </a>
  35. <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
  36. <a name="navbar.top.firstrow">
  37. <!-- -->
  38. </a>
  39. <ul class="navList" title="Navigation">
  40. <li><a href="../../../../overview-summary.html">Overview</a></li>
  41. <li><a href="package-summary.html">Package</a></li>
  42. <li class="navBarCell1Rev">Class</li>
  43. <li><a href="package-tree.html">Tree</a></li>
  44. <li><a href="../../../../deprecated-list.html">Deprecated</a></li>
  45. <li><a href="../../../../index-files/index-1.html">Index</a></li>
  46. <li><a href="../../../../help-doc.html">Help</a></li>
  47. </ul>
  48. </div>
  49. <div class="subNav">
  50. <ul class="navList">
  51. <li>Prev&nbsp;Class</li>
  52. <li><a href="../../../../com/zipcodewilmington/streams/tools/ReflectionUtils.html" title="class in com.zipcodewilmington.streams.tools"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
  53. </ul>
  54. <ul class="navList">
  55. <li><a href="../../../../index.html?com/zipcodewilmington/streams/tools/RandomUtils.html" target="_top">Frames</a></li>
  56. <li><a href="RandomUtils.html" target="_top">No&nbsp;Frames</a></li>
  57. </ul>
  58. <ul class="navList" id="allclasses_navbar_top">
  59. <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
  60. </ul>
  61. <div>
  62. <script type="text/javascript"><!--
  63. allClassesLink = document.getElementById("allclasses_navbar_top");
  64. if(window==top) {
  65. allClassesLink.style.display = "block";
  66. }
  67. else {
  68. allClassesLink.style.display = "none";
  69. }
  70. //-->
  71. </script>
  72. </div>
  73. <div>
  74. <ul class="subNavList">
  75. <li>Summary:&nbsp;</li>
  76. <li>Nested&nbsp;|&nbsp;</li>
  77. <li>Field&nbsp;|&nbsp;</li>
  78. <li>Constr&nbsp;|&nbsp;</li>
  79. <li><a href="#method.summary">Method</a></li>
  80. </ul>
  81. <ul class="subNavList">
  82. <li>Detail:&nbsp;</li>
  83. <li>Field&nbsp;|&nbsp;</li>
  84. <li>Constr&nbsp;|&nbsp;</li>
  85. <li><a href="#method.detail">Method</a></li>
  86. </ul>
  87. </div>
  88. <a name="skip.navbar.top">
  89. <!-- -->
  90. </a></div>
  91. <!-- ========= END OF TOP NAVBAR ========= -->
  92. <!-- ======== START OF CLASS DATA ======== -->
  93. <div class="header">
  94. <div class="subTitle">com.zipcodewilmington.streams.tools</div>
  95. <h2 title="Class RandomUtils" class="title">Class RandomUtils</h2>
  96. </div>
  97. <div class="contentContainer">
  98. <ul class="inheritance">
  99. <li>java.lang.Object</li>
  100. <li>
  101. <ul class="inheritance">
  102. <li>com.zipcodewilmington.streams.tools.RandomUtils</li>
  103. </ul>
  104. </li>
  105. </ul>
  106. <div class="description">
  107. <ul class="blockList">
  108. <li class="blockList">
  109. <hr>
  110. <br>
  111. <pre>public final class <span class="typeNameLabel">RandomUtils</span>
  112. extends java.lang.Object</pre>
  113. <div class="block">Created by Leon on 2/4/2017.</div>
  114. </li>
  115. </ul>
  116. </div>
  117. <div class="summary">
  118. <ul class="blockList">
  119. <li class="blockList">
  120. <!-- ========== METHOD SUMMARY =========== -->
  121. <ul class="blockList">
  122. <li class="blockList"><a name="method.summary">
  123. <!-- -->
  124. </a>
  125. <h3>Method Summary</h3>
  126. <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
  127. <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
  128. <tr>
  129. <th class="colFirst" scope="col">Modifier and Type</th>
  130. <th class="colLast" scope="col">Method and Description</th>
  131. </tr>
  132. <tr id="i0" class="altColor">
  133. <td class="colFirst"><code>static boolean</code></td>
  134. <td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/zipcodewilmington/streams/tools/RandomUtils.html#createBoolean-float-">createBoolean</a></span>(float&nbsp;percentage)</code>&nbsp;</td>
  135. </tr>
  136. <tr id="i1" class="rowColor">
  137. <td class="colFirst"><code>static java.lang.Character</code></td>
  138. <td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/zipcodewilmington/streams/tools/RandomUtils.html#createCharacter-char-char-">createCharacter</a></span>(char&nbsp;min,
  139. char&nbsp;max)</code>&nbsp;</td>
  140. </tr>
  141. <tr id="i2" class="altColor">
  142. <td class="colFirst"><code>static java.awt.Color</code></td>
  143. <td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/zipcodewilmington/streams/tools/RandomUtils.html#createColor-int-int-int-">createColor</a></span>(int&nbsp;maxRed,
  144. int&nbsp;maxGreen,
  145. int&nbsp;maxBlue)</code>&nbsp;</td>
  146. </tr>
  147. <tr id="i3" class="rowColor">
  148. <td class="colFirst"><code>static java.util.Date</code></td>
  149. <td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/zipcodewilmington/streams/tools/RandomUtils.html#createDate-int-int-">createDate</a></span>(int&nbsp;minYear,
  150. int&nbsp;maxYear)</code>&nbsp;</td>
  151. </tr>
  152. <tr id="i4" class="altColor">
  153. <td class="colFirst"><code>static java.lang.Double</code></td>
  154. <td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/zipcodewilmington/streams/tools/RandomUtils.html#createDouble-java.lang.Double-java.lang.Double-">createDouble</a></span>(java.lang.Double&nbsp;min,
  155. java.lang.Double&nbsp;max)</code>&nbsp;</td>
  156. </tr>
  157. <tr id="i5" class="rowColor">
  158. <td class="colFirst"><code>static java.lang.Float</code></td>
  159. <td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/zipcodewilmington/streams/tools/RandomUtils.html#createFloat-float-float-">createFloat</a></span>(float&nbsp;min,
  160. float&nbsp;max)</code>&nbsp;</td>
  161. </tr>
  162. <tr id="i6" class="altColor">
  163. <td class="colFirst"><code>static java.lang.Integer</code></td>
  164. <td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/zipcodewilmington/streams/tools/RandomUtils.html#createInteger-java.lang.Integer-java.lang.Integer-">createInteger</a></span>(java.lang.Integer&nbsp;min,
  165. java.lang.Integer&nbsp;max)</code>&nbsp;</td>
  166. </tr>
  167. <tr id="i7" class="rowColor">
  168. <td class="colFirst"><code>static java.lang.Long</code></td>
  169. <td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/zipcodewilmington/streams/tools/RandomUtils.html#createLong-java.lang.Long-java.lang.Long-">createLong</a></span>(java.lang.Long&nbsp;min,
  170. java.lang.Long&nbsp;max)</code>&nbsp;</td>
  171. </tr>
  172. <tr id="i8" class="altColor">
  173. <td class="colFirst"><code>static java.lang.String</code></td>
  174. <td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/zipcodewilmington/streams/tools/RandomUtils.html#createString-char-char-int-">createString</a></span>(char&nbsp;min,
  175. char&nbsp;max,
  176. int&nbsp;stringLength)</code>&nbsp;</td>
  177. </tr>
  178. <tr id="i9" class="rowColor">
  179. <td class="colFirst"><code>static java.lang.String[]</code></td>
  180. <td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/zipcodewilmington/streams/tools/RandomUtils.html#createStrings-char-char-int-int-">createStrings</a></span>(char&nbsp;min,
  181. char&nbsp;max,
  182. int&nbsp;stringLength,
  183. int&nbsp;stringCount)</code>&nbsp;</td>
  184. </tr>
  185. <tr id="i10" class="altColor">
  186. <td class="colFirst"><code>static &lt;E&gt;&nbsp;E</code></td>
  187. <td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/zipcodewilmington/streams/tools/RandomUtils.html#selectElement-E:A-">selectElement</a></span>(E[]&nbsp;array)</code>&nbsp;</td>
  188. </tr>
  189. <tr id="i11" class="rowColor">
  190. <td class="colFirst"><code>static java.lang.String</code></td>
  191. <td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/zipcodewilmington/streams/tools/RandomUtils.html#shuffleCasing-java.lang.String-">shuffleCasing</a></span>(java.lang.String&nbsp;str)</code>&nbsp;</td>
  192. </tr>
  193. <tr id="i12" class="altColor">
  194. <td class="colFirst"><code>static java.lang.String[]</code></td>
  195. <td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/zipcodewilmington/streams/tools/RandomUtils.html#shuffleStringArray-java.lang.String...-">shuffleStringArray</a></span>(java.lang.String...&nbsp;array)</code>&nbsp;</td>
  196. </tr>
  197. </table>
  198. <ul class="blockList">
  199. <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
  200. <!-- -->
  201. </a>
  202. <h3>Methods inherited from class&nbsp;java.lang.Object</h3>
  203. <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
  204. </ul>
  205. </li>
  206. </ul>
  207. </li>
  208. </ul>
  209. </div>
  210. <div class="details">
  211. <ul class="blockList">
  212. <li class="blockList">
  213. <!-- ============ METHOD DETAIL ========== -->
  214. <ul class="blockList">
  215. <li class="blockList"><a name="method.detail">
  216. <!-- -->
  217. </a>
  218. <h3>Method Detail</h3>
  219. <a name="createBoolean-float-">
  220. <!-- -->
  221. </a>
  222. <ul class="blockList">
  223. <li class="blockList">
  224. <h4>createBoolean</h4>
  225. <pre>public static&nbsp;boolean&nbsp;createBoolean(float&nbsp;percentage)</pre>
  226. <dl>
  227. <dt><span class="returnLabel">Returns:</span></dt>
  228. <dd>true with the likelihood of specified percentage</dd>
  229. </dl>
  230. </li>
  231. </ul>
  232. <a name="createCharacter-char-char-">
  233. <!-- -->
  234. </a>
  235. <ul class="blockList">
  236. <li class="blockList">
  237. <h4>createCharacter</h4>
  238. <pre>public static&nbsp;java.lang.Character&nbsp;createCharacter(char&nbsp;min,
  239. char&nbsp;max)</pre>
  240. <dl>
  241. <dt><span class="returnLabel">Returns:</span></dt>
  242. <dd>a random character between the specified min and max character range</dd>
  243. </dl>
  244. </li>
  245. </ul>
  246. <a name="createDouble-java.lang.Double-java.lang.Double-">
  247. <!-- -->
  248. </a>
  249. <ul class="blockList">
  250. <li class="blockList">
  251. <h4>createDouble</h4>
  252. <pre>public static&nbsp;java.lang.Double&nbsp;createDouble(java.lang.Double&nbsp;min,
  253. java.lang.Double&nbsp;max)</pre>
  254. <dl>
  255. <dt><span class="returnLabel">Returns:</span></dt>
  256. <dd>a random double between the specified min and max numeric range</dd>
  257. </dl>
  258. </li>
  259. </ul>
  260. <a name="createFloat-float-float-">
  261. <!-- -->
  262. </a>
  263. <ul class="blockList">
  264. <li class="blockList">
  265. <h4>createFloat</h4>
  266. <pre>public static&nbsp;java.lang.Float&nbsp;createFloat(float&nbsp;min,
  267. float&nbsp;max)</pre>
  268. <dl>
  269. <dt><span class="returnLabel">Returns:</span></dt>
  270. <dd>a random float between the specified min and max numeric range</dd>
  271. </dl>
  272. </li>
  273. </ul>
  274. <a name="createInteger-java.lang.Integer-java.lang.Integer-">
  275. <!-- -->
  276. </a>
  277. <ul class="blockList">
  278. <li class="blockList">
  279. <h4>createInteger</h4>
  280. <pre>public static&nbsp;java.lang.Integer&nbsp;createInteger(java.lang.Integer&nbsp;min,
  281. java.lang.Integer&nbsp;max)</pre>
  282. <dl>
  283. <dt><span class="returnLabel">Returns:</span></dt>
  284. <dd>a random integer between the specified min and max numeric range</dd>
  285. </dl>
  286. </li>
  287. </ul>
  288. <a name="createLong-java.lang.Long-java.lang.Long-">
  289. <!-- -->
  290. </a>
  291. <ul class="blockList">
  292. <li class="blockList">
  293. <h4>createLong</h4>
  294. <pre>public static&nbsp;java.lang.Long&nbsp;createLong(java.lang.Long&nbsp;min,
  295. java.lang.Long&nbsp;max)</pre>
  296. <dl>
  297. <dt><span class="returnLabel">Returns:</span></dt>
  298. <dd>a random long between the specified min and max numeric range</dd>
  299. </dl>
  300. </li>
  301. </ul>
  302. <a name="createString-char-char-int-">
  303. <!-- -->
  304. </a>
  305. <ul class="blockList">
  306. <li class="blockList">
  307. <h4>createString</h4>
  308. <pre>public static&nbsp;java.lang.String&nbsp;createString(char&nbsp;min,
  309. char&nbsp;max,
  310. int&nbsp;stringLength)</pre>
  311. <dl>
  312. <dt><span class="returnLabel">Returns:</span></dt>
  313. <dd>a random string of the specified length containing characters in the specified range</dd>
  314. </dl>
  315. </li>
  316. </ul>
  317. <a name="createStrings-char-char-int-int-">
  318. <!-- -->
  319. </a>
  320. <ul class="blockList">
  321. <li class="blockList">
  322. <h4>createStrings</h4>
  323. <pre>public static&nbsp;java.lang.String[]&nbsp;createStrings(char&nbsp;min,
  324. char&nbsp;max,
  325. int&nbsp;stringLength,
  326. int&nbsp;stringCount)</pre>
  327. <dl>
  328. <dt><span class="returnLabel">Returns:</span></dt>
  329. <dd>an array of random string objects of the specified length containing characters in the specified range</dd>
  330. </dl>
  331. </li>
  332. </ul>
  333. <a name="createDate-int-int-">
  334. <!-- -->
  335. </a>
  336. <ul class="blockList">
  337. <li class="blockList">
  338. <h4>createDate</h4>
  339. <pre>public static&nbsp;java.util.Date&nbsp;createDate(int&nbsp;minYear,
  340. int&nbsp;maxYear)</pre>
  341. <dl>
  342. <dt><span class="returnLabel">Returns:</span></dt>
  343. <dd>a random date object ranging between the specified dates</dd>
  344. </dl>
  345. </li>
  346. </ul>
  347. <a name="selectElement-java.lang.Object:A-">
  348. <!-- -->
  349. </a><a name="selectElement-E:A-">
  350. <!-- -->
  351. </a>
  352. <ul class="blockList">
  353. <li class="blockList">
  354. <h4>selectElement</h4>
  355. <pre>public static&nbsp;&lt;E&gt;&nbsp;E&nbsp;selectElement(E[]&nbsp;array)</pre>
  356. <dl>
  357. <dt><span class="returnLabel">Returns:</span></dt>
  358. <dd>a random element from the sepcified array</dd>
  359. </dl>
  360. </li>
  361. </ul>
  362. <a name="shuffleCasing-java.lang.String-">
  363. <!-- -->
  364. </a>
  365. <ul class="blockList">
  366. <li class="blockList">
  367. <h4>shuffleCasing</h4>
  368. <pre>public static&nbsp;java.lang.String&nbsp;shuffleCasing(java.lang.String&nbsp;str)</pre>
  369. <dl>
  370. <dt><span class="returnLabel">Returns:</span></dt>
  371. <dd>specified string value with random upper and lower casing assigned to each character</dd>
  372. </dl>
  373. </li>
  374. </ul>
  375. <a name="shuffleStringArray-java.lang.String...-">
  376. <!-- -->
  377. </a>
  378. <ul class="blockList">
  379. <li class="blockList">
  380. <h4>shuffleStringArray</h4>
  381. <pre>public static&nbsp;java.lang.String[]&nbsp;shuffleStringArray(java.lang.String...&nbsp;array)</pre>
  382. <dl>
  383. <dt><span class="returnLabel">Returns:</span></dt>
  384. <dd>shuffles the specified string array</dd>
  385. </dl>
  386. </li>
  387. </ul>
  388. <a name="createColor-int-int-int-">
  389. <!-- -->
  390. </a>
  391. <ul class="blockListLast">
  392. <li class="blockList">
  393. <h4>createColor</h4>
  394. <pre>public static&nbsp;java.awt.Color&nbsp;createColor(int&nbsp;maxRed,
  395. int&nbsp;maxGreen,
  396. int&nbsp;maxBlue)</pre>
  397. <dl>
  398. <dt><span class="returnLabel">Returns:</span></dt>
  399. <dd>a random color with the specified maximum rgb values</dd>
  400. </dl>
  401. </li>
  402. </ul>
  403. </li>
  404. </ul>
  405. </li>
  406. </ul>
  407. </div>
  408. </div>
  409. <!-- ========= END OF CLASS DATA ========= -->
  410. <!-- ======= START OF BOTTOM NAVBAR ====== -->
  411. <div class="bottomNav"><a name="navbar.bottom">
  412. <!-- -->
  413. </a>
  414. <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
  415. <a name="navbar.bottom.firstrow">
  416. <!-- -->
  417. </a>
  418. <ul class="navList" title="Navigation">
  419. <li><a href="../../../../overview-summary.html">Overview</a></li>
  420. <li><a href="package-summary.html">Package</a></li>
  421. <li class="navBarCell1Rev">Class</li>
  422. <li><a href="package-tree.html">Tree</a></li>
  423. <li><a href="../../../../deprecated-list.html">Deprecated</a></li>
  424. <li><a href="../../../../index-files/index-1.html">Index</a></li>
  425. <li><a href="../../../../help-doc.html">Help</a></li>
  426. </ul>
  427. </div>
  428. <div class="subNav">
  429. <ul class="navList">
  430. <li>Prev&nbsp;Class</li>
  431. <li><a href="../../../../com/zipcodewilmington/streams/tools/ReflectionUtils.html" title="class in com.zipcodewilmington.streams.tools"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
  432. </ul>
  433. <ul class="navList">
  434. <li><a href="../../../../index.html?com/zipcodewilmington/streams/tools/RandomUtils.html" target="_top">Frames</a></li>
  435. <li><a href="RandomUtils.html" target="_top">No&nbsp;Frames</a></li>
  436. </ul>
  437. <ul class="navList" id="allclasses_navbar_bottom">
  438. <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
  439. </ul>
  440. <div>
  441. <script type="text/javascript"><!--
  442. allClassesLink = document.getElementById("allclasses_navbar_bottom");
  443. if(window==top) {
  444. allClassesLink.style.display = "block";
  445. }
  446. else {
  447. allClassesLink.style.display = "none";
  448. }
  449. //-->
  450. </script>
  451. </div>
  452. <div>
  453. <ul class="subNavList">
  454. <li>Summary:&nbsp;</li>
  455. <li>Nested&nbsp;|&nbsp;</li>
  456. <li>Field&nbsp;|&nbsp;</li>
  457. <li>Constr&nbsp;|&nbsp;</li>
  458. <li><a href="#method.summary">Method</a></li>
  459. </ul>
  460. <ul class="subNavList">
  461. <li>Detail:&nbsp;</li>
  462. <li>Field&nbsp;|&nbsp;</li>
  463. <li>Constr&nbsp;|&nbsp;</li>
  464. <li><a href="#method.detail">Method</a></li>
  465. </ul>
  466. </div>
  467. <a name="skip.navbar.bottom">
  468. <!-- -->
  469. </a></div>
  470. <!-- ======== END OF BOTTOM NAVBAR ======= -->
  471. </body>
  472. </html>