A highly random number generator
-
Cool, it even as a SEX instruction. ;)
Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802
Now you have hit my nose on a potential bug! The X register designates the stack pointer. The SEX instruction sets the value of X and this way makes one of the registers the current stack pointer. Typically this is register 2 and does not change as long as the program runs. At the end of the little routine I restore some registers from values which I saved on the stack at the beginning. The INC R2 and LDN R2 instructions near the end assume that R2 is the stack pointer. If it's not, the registers will not be restored properly and the stack pointe will be corrupted. INC R2 must be replaced by IRX (increment the register designated by the value of X) and LDN R2 must be replaced by LDX (load via the register designated by X). This way the code will work properly, no matter which register is currently the stack pointer. What a dumb mistake, and I bet it will show up in even more places! That's code that has worked for many years, but obviously only because I did not do much juggling with different stack pointers.
I have lived with several Zen masters - all of them were cats.
-
Nish Nishant wrote:
but was stunned to see it fluctuate like that every minute or so.
I imagine that, if you had the $ to pay for access, the microsecond fluctuations of international currency exchanges would make a good random number generator too. However, nothing beats [The Hardest Working Office Design In America Encrypts Your Data–With Lava Lamps](https://www.fastcodesign.com/90137157/the-hardest-working-office-design-in-america-encrypts-your-data-with-lava-lamps).
Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802
All of the random number generators based on a commodity's price produce "brown" noise - the price varies in a manner similar to Brownian motion. Any idea how to convert this to "white" noise?
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack. --Winston Churchill
-
Cool, it even as a SEX instruction. ;)
Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802
Is that a synonym for the NOP instruction ?
I'd rather be phishing!
-
Now you have hit my nose on a potential bug! The X register designates the stack pointer. The SEX instruction sets the value of X and this way makes one of the registers the current stack pointer. Typically this is register 2 and does not change as long as the program runs. At the end of the little routine I restore some registers from values which I saved on the stack at the beginning. The INC R2 and LDN R2 instructions near the end assume that R2 is the stack pointer. If it's not, the registers will not be restored properly and the stack pointe will be corrupted. INC R2 must be replaced by IRX (increment the register designated by the value of X) and LDN R2 must be replaced by LDX (load via the register designated by X). This way the code will work properly, no matter which register is currently the stack pointer. What a dumb mistake, and I bet it will show up in even more places! That's code that has worked for many years, but obviously only because I did not do much juggling with different stack pointers.
I have lived with several Zen masters - all of them were cats.
CodeWraith wrote:
Now you have hit my nose on a potential bug!
Crazy, the way things work sometimes. I make a flippant remark, and you find a bug! Just last week I was having a conversation with someone that resulted in solving a design flaw that I've been noodling on for a couple years!
Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802
-
Is that a synonym for the NOP instruction ?
I'd rather be phishing!
Nope. With this instruction you can make any of the 16 registers the current stack pointer. It's short for SET X because the X register determines which register is used as the stack pointer. But sure, that mnemonic is not an accident.
I have lived with several Zen masters - all of them were cats.
-
Nish Nishant wrote:
but was stunned to see it fluctuate like that every minute or so.
I imagine that, if you had the $ to pay for access, the microsecond fluctuations of international currency exchanges would make a good random number generator too. However, nothing beats [The Hardest Working Office Design In America Encrypts Your Data–With Lava Lamps](https://www.fastcodesign.com/90137157/the-hardest-working-office-design-in-america-encrypts-your-data-with-lava-lamps).
Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802
There are some things I learn about and I am just amazed.
Charlie Gilley <italic>Stuck in a dysfunctional matrix from which I must escape... "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
-
I'd like to see someone beat this algorithm for true randomness. :-D
class Program
{
static void Main(string[] args)
{
for (int i = 0; i < 10; i++)
{
var random = BitcoinRandom().Result;
Console.WriteLine(random);
Thread.Sleep(15 * 1000);
}
}static async Task<double> BitcoinRandom() { var client = new HttpClient(); var response = await client.GetStringAsync("https://api.coindesk.com/v1/bpi/currentprice.json"); var data = JsonConvert.DeserializeObject<BitcoinInfo>(response); return data.Bpi.Usd.RateFloat; }
}
public partial class BitcoinInfo
{\[JsonProperty("bpi")\] public Bpi Bpi { get; set; }
}
public partial class Bpi
{
[JsonProperty("USD")]
public Currency Usd { get; set; }}
public partial class Currency
{
[JsonProperty("rate_float")]
public double RateFloat { get; set; }
}Nish Nishant Consultant Software Architect Ganymede Software Solutions LLC www.ganymedesoftwaresolutions.com
-
You know what? I actually thought of posting it the week after thanksgiving as I usually do, but with the new crowd here, I was not sure how it'd go. Most people would have just not gotten it :-)
Nish Nishant Consultant Software Architect Ganymede Software Solutions LLC www.ganymedesoftwaresolutions.com
-
You know what? I actually thought of posting it the week after thanksgiving as I usually do, but with the new crowd here, I was not sure how it'd go. Most people would have just not gotten it :-)
Nish Nishant Consultant Software Architect Ganymede Software Solutions LLC www.ganymedesoftwaresolutions.com
-
:laugh:
Nish Nishant Consultant Software Architect Ganymede Software Solutions LLC www.ganymedesoftwaresolutions.com