EverettRandom: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | ## Everett Random Integer Class | |
| 2 | 2 | ||
| 3 | 3 | ### Summary | |
| 4 | 4 | ||
| 5 | 5 | The Everett interpretation of quantum mechanics ("Many Worlds") is that when an interaction is made with an elementary wave function (such as an electron or photon etc) the universe bifurcates. ref: [Wikipedia Many Worlds page](https://en.wikipedia.org/wiki/Many-worlds_interpretation) | |
| 6 | 6 | ||
| 7 | 7 | This happens naturally of course (just via radioactive decays in atoms of your body there are about 5000 bifucations per second) but this component brings into the mix "Free Will". By requesting a random number from the online source, which is a beam-splitter based in Austrailia you are bifurcating the Universe deliberately - that is, based on your Free Will. You may or may not find that interesting, but nevertheless this component gives you this ability (to "play God" with the Universe) | |
| 8 | 8 | ||
| 9 | 9 | The random numbers returned are truly random (i.e. not pseudorandom via algorithm) | |
| 10 | 10 | ||
| 11 | 11 | This package is a wrapper for querying a quantum number generator based in Austrailia.\ | |
| 12 | 12 | \ | |
| 13 | 13 | ---- | |
| 14 | 14 | ||
| 15 | 15 | #### Download | |
| 16 | 16 | ||
| 17 | 17 | - the everettrandom package can be downloaded as a zip from [Lazarus ccr site](https://svn.code.sf.net/p/lazarus-ccr/svn/components/everettrandom/latest_stable/updates/everettrandom.zip) | |
| 18 | 18 | ||
| 19 | - | ||
| 20 | 19 | ---- | |
| 21 | 20 | ||
| 22 | 21 | #### Installation and Usage | |
| 23 | 22 | ||
| 24 | 23 | - Open everettrandom.lpk and compile it. | |
| 25 | 24 | - In your application, include everettrandom as a required package | |
| 26 | 25 | - In a form unit: | |
| 27 | 26 | - In the Uses clause, add ueverettrandom | |
| 28 | 27 | ||
| 29 | - | ||
| 30 | 28 | ---- | |
| 31 | 29 | ||
| 32 | 30 | #### Code | |
| 33 | 31 | ||
| 34 | 32 | - Declare as a variable: | |
| 35 | 33 | ||
| 36 | 34 | ``` pascal | |
| 37 | 35 | MyEverett: TEverett; | |
| 38 | 36 | ``` | |
| 39 | 37 | ||
| 40 | 38 | - In form Create: | |
| 41 | 39 | ||
| 42 | 40 | ``` pascal | |
| 43 | 41 | MyEverett := TEverett.Create(Self); | |
| 44 | 42 | ``` | |
| 45 | 43 | ||
| 46 | 44 | - If you don't want to show a dialog whilst querying the server: | |
| 47 | 45 | ||
| 48 | 46 | ``` pascal | |
| 49 | 47 | MyEverett.ShowWaitDialog:=FALSE; | |
| 50 | 48 | ``` | |
| 51 | 49 | ||
| 52 | 50 | - There are 3 functions that will retrieve a single integer: | |
| 53 | 51 | ||
| 54 | 52 | ``` pascal | |
| 55 | 53 | // Fetch a single random number | |
| 56 | 54 | function MyEverett.GetSingle8Bit: integer; | |
| 57 | 55 | function MyEverett.GetSingle16Bit: integer; | |
| 58 | 56 | function MyEverett.GetSingleHex: String; | |
| 59 | 57 | ``` | |
| 60 | 58 | ||
| 61 | 59 | - Array functions will put results into: | |
| 62 | 60 | - (GetInteger8BitArray, GetInteger16BitArray) populates | |
| 63 | 61 | ``` pascal | |
| 64 | 62 | MyEverett.IntegerArray[0..Pred(ArraySize)] | |
| 65 | 63 | ``` | |
| 66 | 64 | - (GetHexArray) populates | |
| 67 | 65 | ``` pascal | |
| 68 | 66 | MyEverett.HexArray[0..Pred(ArraySize)] | |
| 69 | 67 | ``` | |
| 70 | 68 | - First set the properties: | |
| 71 | 69 | - MyEverett.ArraySize (default=1) | |
| 72 | 70 | - ..and for Hex results | |
| 73 | 71 | - MyEverett.HexSize (default=1) e.g. 1=00-\>FF, 2=0000-\>FFFF, 3=000000-\>FFFFFF etc. | |
| 74 | 72 | - Result for array functions is TRUE(Success) or FALSE(failure) | |
| 75 | 73 | ||
| 76 | 74 | ``` pascal | |
| 77 | 75 | function MyEverett.GetInteger8BitArray:Boolean; | |
| 78 | 76 | function MyEverett.GetInteger16BitArray:Boolean; | |
| 79 | 77 | function MyEverett.GetHexArray:Boolean; | |
| 80 | 78 | ``` | |
| 81 | 79 | ||
| 82 | 80 | ------------------------------------------------------------------------ | |
| 83 | 81 | ||
| 84 | 82 | #### Internationalisation | |
| 85 | 83 | ||
| 86 | 84 | - i8n: everettrandom has a 'locale' folder with all the .po files needed for translation. The base language is English | |
| 87 | 85 | ||
| 88 | - | ||
| 89 | 86 | ---- | |
| 90 | 87 | ||
| 91 | 88 | #### Demo App | |
| 92 | 89 | ||
| 93 | 90 | - In the /demo folder is a small application to demonstrate the use of everettrandom | |
| 94 | 91 | - Compile and run the app to see if it runs OK on your system. | |
| 95 | 92 | - *The server can be busy, so be patient and wait for the result* | |
| 96 | 93 | - Study the source code to see how to use the methods and properties of the everettrandom class | |
| 97 | 94 | ||
| 98 | - | ||
| 99 | 95 | ---- | |
| 100 | 96 | ||
| 101 | 97 | Minesadorada Last Edited: // | |
| 102 | 98 | ||
| 103 | 99 | --- | |
| 104 | 100 | *From the Free Pascal wiki, page "EverettRandom", as it stood on 2020-11-29 after a change by Jwdietrich, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* | |
| 105 | 101 | Category: Components | |
| 106 | 102 | Category: Packages | |
| 107 | 103 | Category: Statistical algorithms |
