From: C128UserDELETE-THIS on 20 Apr 2010 05:58 There's a source of genuine, true random numbers on the web -- it's called "HotBits" -- derived from radioactive decay. To see what I'm blathering about, visit: http://www.fourmilab.ch/hotbits ....for further information. I have done so, and I've harvested a whole diskful of random bytes! Now I've got 168,656 bytes (664 blocks) of true-random binary data; what do I do with it??? Well, one thing that might be done with it is to use it to replace the Commodore's purely pseudorandom RND() function. Unfortunately, there's a problem. RND() returns a decimal fraction between 0 and 1; HotBits returns 8-bit bytes with integer values between 0 and 255! (Actually, from what I understand, RND() itself stores its current value in multiple bytes, so clearly there is a conversion process taking place.) How does one convert from one form -- I believe it's seven 0-255 value bytes, to a single 0-1 fraction -- to the other form, for use in a floating-point variable? Best of all would be some way of "inserting" those random bytes into whatever area RND() actually uses, so that the next call of RND() would actually "call up" the equivalent HotBits value inserted, but I couldn't even hazard a guess as to how this could be done -- or even if this could be done. What I'm envisioning is a C64 subroutine that would first read in, say, 7 bytes, from the "HotBits" disk, and then either -- 1. Convert them to fractional form and store this value directly into a variable; --OR-- 2. "Insert" them into RND() in such a way, that the next time that the RND() function is called, the value it produces will be the same one that would be produced by item number 1 above. Any help or information would be appreciated. -- _____ %%%% "Glenn P.," <C128UserDELETE-THIS@(AND-THIS)FVI.Net> %%%%% {~._.~} ----------------------------------------------------------------- _( Y )_ ...For what you see and hear depends a good deal on where you are (:_~*~_:) standing: it also depends on what sort of person you are... (_)-(_) --Lewis, C.S.: "The Magician's Nephew", ========= Book I in "The Chronicles Of Narnia". :: Take Note Of The Spam Block On My E-Mail Address! ::
From: Groepaz on 20 Apr 2010 08:59 C128UserDELETE-THIS(a)FVI.Net wrote: > There's a source of genuine, true random numbers on the web -- it's called > "HotBits" -- derived from radioactive decay. To see what I'm blathering > about, visit: [...] > Any help or information would be appreciated. that idea has one fundamental flaw: although those random bits you might have gathered and saved on your disk might be "truely random" - the outcome of your idea will be anything but that. unless everytime you use your modified RND, you would also create a completely new disk with completely new random data =P -- http://www.hitmen-console.org http://magicdisk.untergrund.net http://www.pokefinder.org http://ftp.pokefinder.org ....the harm was done: the topic became known as "computer science"---which, actually, is like referring to surgery as "knife science"---and it was firmly implanted in people's minds that computing science is about machines and their peripheral equipment. <Edsgar Dijkstra>
From: C128UserDELETE-THIS on 20 Apr 2010 12:51 On 20-Apr-10 at 2:59pm +0200, <groepaz(a)gmx.net> wrote: >> There's a source of genuine, true random numbers on the web -- it's called >> "HotBits" -- derived from radioactive decay. To see what I'm blathering >> about, visit: > That idea has one fundamental flaw: although those random bits you might > have gathered and saved on your disk might be "truely random" - the outcome > of your idea will be anything but that. unless everytime you use your > modified RND, you would also create a completely new disk with completely > new random data. 1. Only a small portion of the disk will be used at any given time. The only REAL challenge is one of bookmarking -- keeping track of where the routine "has left off" on the last byte reading. With that in place, I don't anticipate running out of data, or needing to update the disk, any time soon. 2. Let me worry about that. It's the subroutine I need at present: Details on its diet and feeding (so to speak) are MY concern, not yours. :) -- _____ %%%%%%%%% "Glenn P.," <C128UserDELETE-THIS(a)FVI.Net> %%%%%%%%%% {~._.~} ----------------------------------------------------------------- _( Y )_ ...For what you see and hear depends a good deal on where you are (:_~*~_:) standing: it also depends on what sort of person you are... (_)-(_) --Lewis, C.S.: "The Magician's Nephew", ========= Book I in "The Chronicles Of Narnia". :: Take Note Of The Spam Block On My E-Mail Address! ::
From: Vanessa Ezekowitz on 20 Apr 2010 18:47 On Tue, 20 Apr 2010 12:51:19 -0400 C128UserDELETE-THIS(a)FVI.Net wrote: > On 20-Apr-10 at 2:59pm +0200, <groepaz(a)gmx.net> wrote: > > >> There's a source of genuine, true random numbers on the web -- it's > >> called "HotBits" [...]-- derived from radioactive decay. To see what I'm > >> blathering about, visit: > > [ Snip part describing having saved 664 blocks worth of true random data] I'm not sure if I understand some parts of the original post correctly, but please allow me to present my thoughts: Since you want your program to receive data that's as close to truly random as is practical, add a routine to the initialization state of your program, wherein you generate a few random bytes at the start of your program using the BASIC random number generator. If you want, maybe you could pick a few from the oscillator-3 output from the SID instead, with noise (at max "frequency") as the selected waveform. Either should give you something random enough for this. Do just enough math on those bytes to generate a block+byte address into the hot bits disk, and set that index as the start of your current data set instead of using a persistent bookmark. Then just pull new bytes from the hot bits disk from that point forward as you had planned, but dispense with the bookmark. For all practical purposes, the result will be as close to random as anyone could ever hope to accomplish short of hooking up that hot bits generator itself to the C64. To extend on Groepaz's thoughts, it would probably make sense to find some way to have your web server auto-generate a new hot bits disk and place it for download maybe every 90 days or so. Then you could just add a function to the program that would pop up a reminder every 2000 runs or so, to remind the user to go to your website when they get a chance and download a new copy of the hot bits disk. Don't forget to give the user the option to permanently ignore this reminder. For some users, it might take *years* to run out of random bytes. For others, maybe not as long, it's hard to say. Store the number of runs of the program somewhere on the current hot bits disk. Of course each newly generated/downloaded hot bits image would have these bytes preset to zero. :-) How many runs it takes to use up the whole disk depends of course on how many bytes you expect to read during each session. -- "There are some things in life worth obsessing over. Most things aren't, and when you learn that, life improves." http://starbase.globalpc.net/~ezekowitz Vanessa E. <vanDEesLEsaTEezTHekISowitz(a)gmail.com> (Delete the obvious to email me) --- news://freenews.netfront.net/ - complaints: news(a)netfront.net ---
From: Anton Treuenfels on 21 Apr 2010 23:42 <C128UserDELETE-THIS(a)FVI.Net> wrote in message news:Pine.LNX.4.61.1004200552050.32112(a)Bfjrtb.SbkInyyrl.arg... > > How does one convert from one form -- I believe it's seven 0-255 value > bytes, > to a single 0-1 fraction -- to the other form, for use in a floating-point > variable? > > Best of all would be some way of "inserting" those random bytes into > whatever > area RND() actually uses, so that the next call of RND() would actually > "call > up" the equivalent HotBits value inserted, but I couldn't even hazard a > guess > as to how this could be done -- or even if this could be done. > > What I'm envisioning is a C64 subroutine that would first read in, say, 7 > bytes, from the "HotBits" disk, and then either -- > > 1. Convert them to fractional form and store this value directly into a > variable; > --OR-- > 2. "Insert" them into RND() in such a way, that the next time that the > RND() > function is called, the value it produces will be the same one that would > be > produced by item number 1 above. A floating point number is just an interpretation of five consecutive memory bytes. If you don't care what the range of value is you don't have to do anything but stick five bytes off your disk into memory somewhere and let BASIC know where that is. If you do care what the range is - say between zero and one - you'll have to make sure the exponent byte has the proper value. Probably a constant value ($80? $81?), and all you can change is the other four bytes. That makes 2^32 different values possible, but presumably they will come in a non-repeating sequence of whatever length you have patience for. The USR() function might be a good way to get values into a BASIC variable. - Anton Treuenfels
|
Pages: 1 Prev: Free PSN cards Next: Commodore FTP Sites Listing -- Last update 21 Aug 2009 |