| 1 |
<html><head> |
|---|
| 2 |
<META http-equiv="content-type" content="text/html; charset=utf-8"> |
|---|
| 3 |
<title>tango.scrapple.util.uuid.RandomUuidGen</title> |
|---|
| 4 |
</head><body> |
|---|
| 5 |
<h1>tango.scrapple.util.uuid.RandomUuidGen</h1> |
|---|
| 6 |
<!-- Generated by Ddoc from RandomUuidGen.d --> |
|---|
| 7 |
<b>License:</b><br> |
|---|
| 8 |
BSD style: |
|---|
| 9 |
|
|---|
| 10 |
<br><br> |
|---|
| 11 |
<b>author:</b><br> |
|---|
| 12 |
Max Samukha |
|---|
| 13 |
<br><br> |
|---|
| 14 |
|
|---|
| 15 |
Random (version 4) UUID generator. The likelihood of duplicates is |
|---|
| 16 |
relatively high with this type of generator. Try to avoid using it |
|---|
| 17 |
in production. |
|---|
| 18 |
|
|---|
| 19 |
<br><br> |
|---|
| 20 |
|
|---|
| 21 |
<dl><dt><big>struct <u>RandomUuidGen</u>(Rand); |
|---|
| 22 |
</big></dt> |
|---|
| 23 |
<dd>Represents a random UUID generator. |
|---|
| 24 |
<br><br> |
|---|
| 25 |
<b>Params:</b><br> |
|---|
| 26 |
<table><tr><td>Rand</td> |
|---|
| 27 |
<td>Randomizer type. The rendomizer type must be a callable type |
|---|
| 28 |
taking no arguments and returning int or uint.</td></tr> |
|---|
| 29 |
</table><br> |
|---|
| 30 |
<b>Examples:</b><br> |
|---|
| 31 |
<pre class="d_code"><font color=blue>import</font> tango.math.Random; |
|---|
| 32 |
|
|---|
| 33 |
<font color=blue>auto</font> random = <font color=blue>new</font> Random; |
|---|
| 34 |
|
|---|
| 35 |
<font color=green>// Create a random UUID generator that will use |
|---|
| 36 |
</font><font color=green>// Tango's randomizer. |
|---|
| 37 |
</font><font color=blue>auto</font> randGen = <u>RandomUuidGen</u>!(<font color=blue>typeof</font>(&random.next))(&random.next); |
|---|
| 38 |
|
|---|
| 39 |
<font color=green>// Generate a random UUID. |
|---|
| 40 |
</font><font color=blue>auto</font> uuid = randGen(); |
|---|
| 41 |
</pre> |
|---|
| 42 |
<br><br> |
|---|
| 43 |
|
|---|
| 44 |
<dl><dt><big>Rand <u>rand</u>; |
|---|
| 45 |
</big></dt> |
|---|
| 46 |
<dd>Randomizer. |
|---|
| 47 |
|
|---|
| 48 |
<br><br> |
|---|
| 49 |
|
|---|
| 50 |
</dd> |
|---|
| 51 |
<dt><big>RandomUuidGen <u>opCall</u>(Rand <i>rand</i>); |
|---|
| 52 |
</big></dt> |
|---|
| 53 |
<dd>Creates a new generator instance, which will use the supplied |
|---|
| 54 |
randomizer. |
|---|
| 55 |
<br><br> |
|---|
| 56 |
<b>Params:</b><br> |
|---|
| 57 |
<table><tr><td>Rand <i>rand</i></td> |
|---|
| 58 |
<td>Randomizer.</td></tr> |
|---|
| 59 |
</table><br> |
|---|
| 60 |
|
|---|
| 61 |
</dd> |
|---|
| 62 |
<dt><big>Uuid <u>opCall</u>(); |
|---|
| 63 |
</big></dt> |
|---|
| 64 |
<dd>Generates a random UUID. Not thread-safe. |
|---|
| 65 |
|
|---|
| 66 |
<br><br> |
|---|
| 67 |
|
|---|
| 68 |
</dd> |
|---|
| 69 |
</dl> |
|---|
| 70 |
</dd> |
|---|
| 71 |
<dt><big>const RandomUuidGen!(int function()) <u>newUuid</u>; |
|---|
| 72 |
</big></dt> |
|---|
| 73 |
<dd>Generates a random UUID using the C runtime's random number generator. |
|---|
| 74 |
<br><br> |
|---|
| 75 |
<b>Example:</b><br> |
|---|
| 76 |
<pre class="d_code"><font color=blue>auto</font> uuid = <u>newUuid</u>(); |
|---|
| 77 |
</pre> |
|---|
| 78 |
<br><br> |
|---|
| 79 |
|
|---|
| 80 |
</dd> |
|---|
| 81 |
</dl> |
|---|
| 82 |
|
|---|
| 83 |
<hr><small>Page generated by <a href="http://www.digitalmars.com/d/1.0/ddoc.html">Ddoc</a>. Copyright (c) 2007 Max Samukha. All rights reserved |
|---|
| 84 |
|
|---|
| 85 |
</small> |
|---|
| 86 |
</body></html> |
|---|