<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Zubair Ahmed Rafi</title>
    <description>The latest articles on DEV Community by Zubair Ahmed Rafi (@mcqueen).</description>
    <link>https://dev.to/mcqueen</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1721165%2Ff45eeef7-22f0-43a0-935e-997347788be0.jpg</url>
      <title>DEV Community: Zubair Ahmed Rafi</title>
      <link>https://dev.to/mcqueen</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mcqueen"/>
    <language>en</language>
    <item>
      <title>Physics is changed now it's time for computer science</title>
      <dc:creator>Zubair Ahmed Rafi</dc:creator>
      <pubDate>Mon, 17 Mar 2025 08:50:55 +0000</pubDate>
      <link>https://dev.to/mcqueen/physics-is-changed-now-its-time-for-computer-science-o9c</link>
      <guid>https://dev.to/mcqueen/physics-is-changed-now-its-time-for-computer-science-o9c</guid>
      <description>&lt;p&gt;&lt;strong&gt;How physics is changed&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;few days back Italy’s National Research Council (CNR) has done something amazing &lt;/p&gt;

&lt;p&gt;You know light, Right? The source of all of humanity &lt;/p&gt;

&lt;p&gt;Now light can be of 2 kind &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Particle 2. wave &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The same research center demonstrated that light can be liquid a decade ago named Bose-Einstein Condensate (BEC) of photons. This is where many photons condense into the same quantum state, behaving like a single fluid entity.&lt;/p&gt;

&lt;p&gt;this time they used a semiconductor made of aluminum gallium arsenide and tried to block light &lt;/p&gt;

&lt;p&gt;Instead of blocking it mixed with the semiconductor and goes into a hybrid particles called polaritons. It basically a particle which blends light and matter it's as simple as that &lt;/p&gt;

&lt;p&gt;Now upon changing some factor like energy input , temperature etc. This particles started forming a structure like a solid but it's a fluid remember. So arises super solid state&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is a super solid state&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A super solid state is like a thing that hold both properties of solid and liquid. It forms a stable structure and has no friction like fluid &lt;/p&gt;

&lt;p&gt;This kind of state existed before but needed too low of temperature but now it's born in room temperature &lt;/p&gt;

&lt;p&gt;*&lt;em&gt;How this gonna effect CS *&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;let's clear some basics first &lt;/p&gt;

&lt;p&gt;🌟 What is a Qubit?&lt;br&gt;
A qubit (short for quantum bit) is like the basic unit of information in quantum computing.&lt;/p&gt;

&lt;p&gt;💡 Compare to regular computers:&lt;br&gt;
Regular computers use bits.&lt;br&gt;
➡️ A bit can be 0 or 1.&lt;br&gt;
A qubit can be 0, 1, or both at the same time! (This is called superposition.)&lt;br&gt;
➡️ And qubits can talk to each other instantly using entanglement.&lt;br&gt;
This makes quantum computers super powerful for certain tasks!&lt;/p&gt;

&lt;p&gt;🧊 Why Super Solid State Is Useful for Qubits&lt;br&gt;
Qubits are fragile!&lt;/p&gt;

&lt;p&gt;They can easily lose their quantum state because of outside noise, vibrations, or heat.&lt;br&gt;
Super solids can help:&lt;br&gt;
✅ Stable: Super solids have an ordered structure (like a crystal), giving qubits a stable home.&lt;br&gt;
✅ Quantum Behavior: They show superfluidity, meaning no friction and no energy loss.&lt;br&gt;
✅ Long Coherence Times: Qubits stay in their quantum state longer, so they can compute more accurately.&lt;/p&gt;

&lt;p&gt;🖥️ How It’s Used in Quantum Computing&lt;br&gt;
If we put qubits inside or on top of a super solid, they can stay stable and work longer.&lt;br&gt;
Super solids may also help create or control qubits themselves because they act quantum even at larger scales.&lt;/p&gt;

&lt;p&gt;So this physics discovery of super solids in room temperature can make qubits stay more stable easily without needing extreme conditions. So we can have quantum computers of super stability at home &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Whats the benefit?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Whats the benefit you asked so imagine a computer having the power to compute at the speed of light. So there will be no NP-hard problem left  &lt;/p&gt;

&lt;p&gt;That's it. Thanks for reading &lt;/p&gt;

&lt;p&gt;Ref: &lt;a href="https://interestingengineering.com/science/scientists-create-supersolid-from-light" rel="noopener noreferrer"&gt;Article&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.techexplorist.com/turned-light-supersolid/97590/" rel="noopener noreferrer"&gt;Article&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/shorts/D4IzB7s7pm8" rel="noopener noreferrer"&gt;short video&lt;/a&gt;&lt;/p&gt;

</description>
      <category>quantum</category>
      <category>computing</category>
      <category>physics</category>
      <category>future</category>
    </item>
    <item>
      <title>Are small language model going to change the future?</title>
      <dc:creator>Zubair Ahmed Rafi</dc:creator>
      <pubDate>Sat, 08 Feb 2025 15:03:05 +0000</pubDate>
      <link>https://dev.to/mcqueen/are-small-language-model-going-to-change-the-future-157l</link>
      <guid>https://dev.to/mcqueen/are-small-language-model-going-to-change-the-future-157l</guid>
      <description>&lt;p&gt;&lt;strong&gt;Small Language Models (SLMs):&lt;/strong&gt; The Future of AI on Your Device&lt;br&gt;
Artificial Intelligence (AI) is evolving, and while Large Language Models (LLMs) dominate the scene, there’s a quiet revolution happening—Small Language Models (SLMs). These compact yet powerful models are changing how we interact with AI, making it more accessible, private, and efficient.&lt;/p&gt;

&lt;p&gt;What is a Small Language Model (SLM)?&lt;br&gt;
Simply put, an SLM is a language model that has fewer parameters than an LLM. But don’t let the word "small" fool you—SLMs pack a punch! They can run offline on your Android device, laptops, or even embedded systems without relying on internet-based AI services.&lt;/p&gt;

&lt;p&gt;Unlike massive LLMs that require cloud computing, SLMs can work on-device, offering greater speed, privacy, and efficiency. However, there's a catch: SLMs are trained for specific tasks, meaning they excel in well-defined domains rather than being general-purpose AIs.&lt;/p&gt;

&lt;p&gt;Why SLMs Matter: Key Advantages&lt;br&gt;
Privacy First 🛡️&lt;br&gt;
Since they run locally, your data stays with you—no external servers needed. This is crucial for sensitive sectors like healthcare, finance, or personal productivity tools.&lt;/p&gt;

&lt;p&gt;Blazing Fast Response ⚡&lt;br&gt;
Without the need to query cloud-based models, responses are instantaneous. No lag, no waiting—just real-time AI at your fingertips.&lt;/p&gt;

&lt;p&gt;Efficient and Cost-Effective 💡&lt;br&gt;
SLMs don’t require expensive cloud servers. You can run them on a laptop, smartphone, or even a smartwatch.&lt;/p&gt;

&lt;p&gt;Offline AI is Here 📵&lt;br&gt;
Imagine an AI assistant that works even without an internet connection. Whether you’re traveling, in remote areas, or just prefer working offline, SLMs make it possible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-World example of SLMs&lt;/strong&gt;&lt;br&gt;
1️⃣ Khan Academy’s AI Tutor - Khanmigo 🎓&lt;br&gt;
Khan Academy's Khanmigo isn’t just a chatbot that spits out answers—it guides students to find solutions themselves. This subject-specific AI is a perfect example of an SLM tailored for education.&lt;/p&gt;

&lt;p&gt;2️⃣ AI Inside Cars 🚗&lt;br&gt;
Microsoft is already working with car manufacturers in London to integrate SLMs into vehicles. These on-device AI models assist with navigation, voice commands, and predictive maintenance—all without needing a cloud connection.&lt;/p&gt;

&lt;p&gt;3️⃣ Privacy-Focused AI in Banking &amp;amp; Healthcare 🏦🩺&lt;br&gt;
Financial institutions and hospitals want AI-powered automation but can’t risk exposing sensitive data to third-party servers. With SLMs, banks can automate fraud detection, and hospitals can provide AI-driven diagnosis without data leaving their secure environment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Future use cases of SLMs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1️⃣ Smart Glasses &amp;amp; Wearable AI 🕶️⌚&lt;br&gt;
Think of smart glasses that translate languages in real-time—all running on an offline SLM. The same applies to smartwatches that analyze health data without sending it to the cloud.&lt;/p&gt;

&lt;p&gt;2️⃣ IoT Devices That Actually "Think" 🤖&lt;br&gt;
Your smart fridge, thermostat, or security camera can have built-in AI without internet dependency. These devices will soon predict and act based on past behaviors, making homes truly smart.&lt;/p&gt;

&lt;p&gt;3️⃣ Coding for large company : &lt;br&gt;
Company want to use AI but also want their code not to expose to llm's they can use slm to use in house AI to faster their need &lt;/p&gt;

&lt;p&gt;SLMs You Can Use Today&lt;br&gt;
If you’re thinking of building your own AI assistant, you don’t need a supercomputer! SLMs can be trained and deployed on a good laptop. Here are two powerful models to start with:&lt;/p&gt;

&lt;p&gt;🔹 Gemma (2B &amp;amp; 7B) - Google DeepMind&lt;br&gt;
Designed for efficiency + high performance&lt;br&gt;
Works well for domain-specific AI assistants &amp;amp; coding help&lt;br&gt;
Can be fine-tuned easily using Google’s TPU or local GPUs&lt;br&gt;
🔹 Phi-2 (2.7B) - Microsoft&lt;br&gt;
Smaller yet powerful for reasoning &amp;amp; logical tasks&lt;br&gt;
Perfect for knowledge-based chatbots &amp;amp; personal assistants&lt;br&gt;
Runs efficiently on consumer hardware&lt;/p&gt;

&lt;p&gt;Final Thoughts&lt;br&gt;
SLMs are making AI more accessible, private, and efficient than ever before. Whether you're a developer or just an AI enthusiast, now is the time to explore these compact powerhouses.&lt;/p&gt;

&lt;p&gt;And if you’re interested in learning how to fine-tune or build an SLM for your own needs, let me know! If this article gets a good response, I’ll dive into the process of training and deploying one yourself.&lt;/p&gt;

&lt;p&gt;The future of AI isn’t just big—it’s small, fast, and personal. 🚀&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How startups get money</title>
      <dc:creator>Zubair Ahmed Rafi</dc:creator>
      <pubDate>Mon, 16 Dec 2024 14:30:34 +0000</pubDate>
      <link>https://dev.to/mcqueen/how-startups-get-money-1dcp</link>
      <guid>https://dev.to/mcqueen/how-startups-get-money-1dcp</guid>
      <description>&lt;p&gt;So today let's learn about start money ,How it gets funded and How is the valuation is calculated &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;em&gt;Types of startup&lt;/em&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;So overall there are 2 types start-up &lt;/p&gt;

&lt;p&gt;1.Self owned startup (bootstraped) &lt;br&gt;
2.Investor money backed startup &lt;/p&gt;

&lt;p&gt;We will mainly talk about the 2nd type. The first type is easy to understand &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You start a business using your own money &lt;/li&gt;
&lt;li&gt;It generates revenue &lt;/li&gt;
&lt;li&gt;you use this revenue to expand &lt;/li&gt;
&lt;li&gt;The cycle goes on&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This kind of startup are less likely to grow to million dollar company as expansion depends on growth and vice versa &lt;/p&gt;

&lt;h2&gt;
  
  
  Investor money backed startup
&lt;/h2&gt;

&lt;p&gt;So you build a startup you want funding for it. Investor usually invest to your startup for a return that return can come for larger investment or public offering in the future. Usually investor buy some share from the company whose value will increase &lt;/p&gt;

&lt;p&gt;*&lt;em&gt;How valuation is set *&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If some investor buy 10% with 10USD then the company value is 100US &lt;br&gt;
Now in future suppose the founder who has 90% or the initial investor want to sell some of their share but this time as the company is growing they sell 5% with 10USD then the valuation rise upto 200USD making the existing share holder's more richer &lt;/p&gt;

&lt;p&gt;Usually founder can keep 50% or up to keep the control but if it's IPO (public company) then there will BOD to control everything &lt;/p&gt;

&lt;p&gt;So there are stages for raising this money.Here is the brief &lt;/p&gt;

&lt;p&gt;N.B it's just generic one it can change based on many parameter  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Pre-Seed Funding&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Definition: The earliest stage of funding where entrepreneurs seek capital to develop their idea into a tangible product or service.&lt;/p&gt;

&lt;p&gt;Purpose: Validate the idea, build an MVP (Minimum Viable Product), and conduct early market research.&lt;/p&gt;

&lt;p&gt;Investors: Founders themselves, friends and family, angel investors, or startup incubators.&lt;/p&gt;

&lt;p&gt;Example Company: Airbnb (2008)&lt;br&gt;
Founders Joe Gebbia and Brian Chesky rented out air mattresses in their apartment to generate $20,000, which served as their pre-seed funding. They used this capital to create the first version of Airbnb.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Seed Funding&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Definition: The first official round of funding that helps startups scale their MVP, hire a team, and gain initial traction.&lt;/p&gt;

&lt;p&gt;Purpose: Validate the business model and refine the product-market fit.&lt;/p&gt;

&lt;p&gt;Investors: Angel investors, early-stage venture capitalists, and equity crowdfunding.&lt;/p&gt;

&lt;p&gt;Example Company: Uber (2009)&lt;br&gt;
Uber raised $200,000 in seed funding from angel investor Garrett Camp. The funds were used to launch the Uber app and begin operations in San Francisco.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Series A Funding&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Definition: Focuses on scaling operations, building a user base, and generating consistent revenue.&lt;/p&gt;

&lt;p&gt;Purpose: Expand the product offering and enter new markets.&lt;br&gt;
Investors: Venture capital firms specializing in early-stage funding.&lt;br&gt;
.&lt;br&gt;
Example Company: Robinhood (2014)&lt;br&gt;
Robinhood raised $13 million in Series A funding led by Index Ventures. The capital helped the startup refine its commission-free trading app and attract more users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Series B Funding&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Definition: Aimed at scaling up even further, focusing on market expansion and improving existing infrastructure.&lt;/p&gt;

&lt;p&gt;Purpose: Optimize processes, increase market share, and build a competitive edge.&lt;/p&gt;

&lt;p&gt;Investors: Larger venture capital firms and private equity firms.&lt;br&gt;
Funding Amount: $15 million - $50 million.&lt;/p&gt;

&lt;p&gt;Example Company: Pinterest (2011)&lt;br&gt;
Pinterest raised $27 million in Series B funding led by Andreessen Horowitz. This funding allowed Pinterest to scale its platform and establish itself as a major social media player.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Series C Funding&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Definition: For late-stage startups that have established themselves and seek to scale globally, develop new products, or acquire other businesses.&lt;/p&gt;

&lt;p&gt;Purpose: Drive significant market expansion and prepare for an IPO or acquisition.&lt;/p&gt;

&lt;p&gt;Investors: Late-stage venture capitalists, private equity firms, and institutional investors.&lt;/p&gt;

&lt;p&gt;Example Company: Stripe (2016)&lt;br&gt;
Stripe raised $150 million in Series C funding, valuing the company at $9.2 billion. This funding supported its global expansion and development of advanced payment solutions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Series D (or Later Rounds)&lt;/strong&gt;&lt;br&gt;
Definition: For companies seeking additional capital to refine their business or achieve profitability. Sometimes called "growth funding."&lt;/p&gt;

&lt;p&gt;Purpose: Expand further, invest in R&amp;amp;D, or address challenges like declining market share.&lt;/p&gt;

&lt;p&gt;Investors: Private equity firms, institutional investors, and sometimes sovereign wealth funds.&lt;/p&gt;

&lt;p&gt;Example Company: SpaceX (2015)&lt;br&gt;
SpaceX raised $1 billion in a funding round led by Google and Fidelity Investments. The capital supported the development of the Starlink satellite program and space exploration initiatives.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Initial Public Offering (IPO)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Definition: The process of offering shares to the public through a stock exchange.&lt;/p&gt;

&lt;p&gt;Purpose: Raise massive capital, provide liquidity to investors, and achieve global recognition.&lt;/p&gt;

&lt;p&gt;Investors: Public market investors, institutional investors, and retail investors.&lt;/p&gt;

&lt;p&gt;Example Company: Facebook (2012)&lt;br&gt;
Facebook raised $16 billion in its IPO, one of the largest in tech history. The capital was used to further expand its global operations and invest in new products like Instagram.&lt;/p&gt;

&lt;p&gt;Thanks for reading &lt;br&gt;
Suggested : &lt;a href="https://dev.toY%20Combinators%20fund%20raising%20guide"&gt;https://www.ycombinator.com/library/4A-a-guide-to-seed-fundraising&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ref : &lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=78Zxx3o55PM" rel="noopener noreferrer"&gt;Sidebean&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=zBUhQPPS9AY" rel="noopener noreferrer"&gt;YC Combinator&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.startups.com/articles/5-types-startup-funding" rel="noopener noreferrer"&gt;Types of funding&lt;/a&gt;&lt;/p&gt;

</description>
      <category>startup</category>
      <category>saas</category>
      <category>indie</category>
    </item>
    <item>
      <title>Why physics Nobel was given to AI researcher ?</title>
      <dc:creator>Zubair Ahmed Rafi</dc:creator>
      <pubDate>Thu, 07 Nov 2024 12:09:10 +0000</pubDate>
      <link>https://dev.to/mcqueen/why-physics-nobel-was-given-to-ai-researcher--3826</link>
      <guid>https://dev.to/mcqueen/why-physics-nobel-was-given-to-ai-researcher--3826</guid>
      <description>&lt;p&gt;So we all may know that this year's Physics Nobel was given to &lt;a href="https://en.wikipedia.org/wiki/John_Hopfield" rel="noopener noreferrer"&gt;John Hoppfield&lt;/a&gt; &amp;amp; &lt;a href="https://en.wikipedia.org/wiki/Geoffrey_Hinton" rel="noopener noreferrer"&gt;Geoffrey Hinton&lt;/a&gt;&lt;br&gt;
And it has sparks a great deal of controversy. So let's understand what they have done? Do they really fall into physics Nobel?&lt;/p&gt;

&lt;p&gt;To understand their work we have to go back to 1980's to understand the paper that inspires this Nobel.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hopfield Network
&lt;/h2&gt;

&lt;p&gt;A Hopfield network is a type of artificial neural network inspired by the human brain. It's designed to store and recall patterns.&lt;/p&gt;

&lt;p&gt;Let me give you some simple analogies and examples for Hopfield Network:&lt;/p&gt;

&lt;h2&gt;
  
  
  Analogy: The Beach Sand
&lt;/h2&gt;

&lt;p&gt;Imagine a beach with small holes scattered across the sand. Each hole represents a specific pattern or memory stored in the network. When you drop a marble onto the beach, it will roll down the slope of the sand until it settles into the nearest hole.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Marble: This represents the input data or query to the network.&lt;/li&gt;
&lt;li&gt;Holes: These are the stored patterns or memories.&lt;/li&gt;
&lt;li&gt;Rolling Process: This simulates the network's process of finding the closest match to the input data. As the marble rolls, it's essentially exploring the energy landscape of the network, seeking the lowest energy state, which corresponds to the most similar stored pattern.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Algorithm:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl4rq1cgw5s1xsqlxl21j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl4rq1cgw5s1xsqlxl21j.png" alt="Image description" width="578" height="355"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above image determines how hopfield network or our brain neurons work. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The first layer is the input: Suppose we saw something(blurry)&lt;/li&gt;
&lt;li&gt;The next layer is inspired by previous layer: Based on what we see our neurons send signals to other neurons. Anything that matched with our memory sends stronger signal &lt;/li&gt;
&lt;li&gt;More layers: Our brain tries to match something to what we saw &lt;/li&gt;
&lt;li&gt;Final layers: We find a match It's a book(suppose we saw a book) Our brain recognized it because it's in our memory &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's compare this brainy activity with mathematical algorithm &lt;/p&gt;

&lt;p&gt;Imagine we have a Hopfield network with three neurons(for simplicity) , each of which can be either +1 (on) or -1 (off). We'll use this network to store a simple pattern and retrieve&lt;/p&gt;

&lt;p&gt;Pattern to Store:&lt;br&gt;
Let’s say we want the network to remember the pattern [+1, -1, +1] for brain comparison that's our brain.&lt;/p&gt;

&lt;p&gt;Training the Network (Setting Weights): We create connections between each pair of neurons to store this pattern.Weights are determined by which one matched with the memory most &lt;/p&gt;

&lt;p&gt;The weight between neuron 1 and neuron 2, W(1,2), and all other weights are calculated based on the product of their values(It a simple one it can vary) in the stored pattern. For simplicity:&lt;br&gt;
𝑊(1,2)=+1×−1=−1&lt;br&gt;
W(1,2)=+1×−1=−1&lt;br&gt;
𝑊(1,3)=+1×+1=+1&lt;br&gt;
W(1,3)=+1×+1=+1&lt;br&gt;
𝑊(2,3)=−1×+1=−1&lt;br&gt;
W(2,3)=−1×+1=−1&lt;/p&gt;

&lt;p&gt;We repeat for all pairs. These weights help the network "remember" the pattern [+1, -1, +1].&lt;/p&gt;

&lt;p&gt;Retrieving a Pattern :&lt;br&gt;
Now we give the network a noisy input, say [+1, +1, +1], which is slightly different from the original pattern.&lt;/p&gt;

&lt;p&gt;Updating Neurons: Each neuron updates its state based on the sum of the weighted inputs from the other neurons(apart from him):&lt;/p&gt;

&lt;p&gt;Neuron 1: Receives input from Neuron 2 and Neuron 3, which are both +1.&lt;br&gt;
New state of Neuron 1 = sign(W(1,2) * Neuron 2 + W(1,3) * Neuron 3) = sign(-1 * +1 + 1 * +1) = sign(0) = +1&lt;br&gt;
Neuron 2: Receives input from Neuron 1 and Neuron 3.&lt;br&gt;
New state of Neuron 2 = sign(W(2,1) * Neuron 1 + W(2,3) * Neuron 3) = sign(-1 * +1 + -1 * +1) = -1&lt;br&gt;
Neuron 3: Receives input from Neuron 1 and Neuron 2.&lt;br&gt;
New state of Neuron 3 = +1 (since inputs confirm it should stay the same).&lt;/p&gt;

&lt;p&gt;Done we have retrieved [+1,-1,+1]&lt;/p&gt;

&lt;p&gt;so this is the contribution for Hopfield to get the Nobel.And this is the main basic for today's AI boom.Let's move to Hinton's Contribution &lt;/p&gt;

&lt;h2&gt;
  
  
  Boltzman Method
&lt;/h2&gt;

&lt;p&gt;It's actually build on Hopfield method.In Hopfield we try to achieve a state from memory.But in Boltzman Method we don't directly read from memory we just have a training data and try to find out which ever output is making a sensible pattern (creating something new). This is used in modern generative AI &lt;/p&gt;

&lt;h2&gt;
  
  
  Analogy:
&lt;/h2&gt;

&lt;p&gt;Imagine a large group of people at a party, each representing a neuron in a Boltzmann machine. The people are milling around, occasionally interacting with each other.&lt;br&gt;
Just like in a Boltzmann machine, each person (neuron) has two possible "states" - they can either be "on" (dancing) or "off" (standing still). The interactions between the people represent the connections between the neurons, with the strength of the connections determining how much influence one person has on another.&lt;br&gt;
The goal of the party, like the Boltzmann machine, is to find a stable configuration where the overall "energy" of the system is minimized. In other words, the goal is to find a configuration where people are arranged in a way that creates the most harmony and least tension between them.&lt;br&gt;
Just as the Boltzmann machine uses a stochastic process to sample different configurations and move towards lower energy states, the people at the party will randomly change their dancing/standing states, moving towards a more harmonious arrangement over time.&lt;br&gt;
The "temperature" of the Boltzmann machine is analogous to the "liveliness" of the party. At high temperatures, the people are more chaotic and willing to change states frequently. As the temperature decreases, the people become more hesitant to change and the system settles into a stable, lower energy configuration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Algorithm :
&lt;/h2&gt;

&lt;p&gt;If you take previous example that Hopfield method solves. Here it does 2 things differently&lt;/p&gt;

&lt;p&gt;1.Hidden layer:  Between Output and known layers from training data we have hidden layers whom weight is determined by probability of stable state &lt;br&gt;
2.Back-propagation: Once a output is there it can back propagate to train again to get different output. IN this back and forth process it outcomes new things &lt;/p&gt;

&lt;p&gt;Here output depend on the training data. IF we only train on [+1,-1,+1] then output will be that. If we train it like [+1,-1,+1],[-1,+1],[+1,-1,+1,-1,+1][-1,+1,-1,+1] ETC then it can generate something new like [+1,-1] etc&lt;/p&gt;

&lt;h2&gt;
  
  
  Is it a physics Nobel
&lt;/h2&gt;

&lt;p&gt;In favour arguement: &lt;/p&gt;

&lt;p&gt;Well as the initial Hopfield(physicists) is inspired by brain not for PC but to memory efficiency in physical world. And it was the main base for Hinton's work.So It's actually physics thing. Also this technique is used in every field from medical to economy so it's impact is unimaginable. Also many physics well known paper also used Hopfield as extension to their work &lt;/p&gt;

&lt;p&gt;In against arguement:&lt;/p&gt;

&lt;p&gt;First of Hopfield was not original it was also inspired from associate memory(in reference). Next if we are giving Nobel to work related to physical world then everything should be gone to physics.Also there is turing-award dedicated for CS. Now they won't be giving awards to physicists. Also The work was too old it's only appreciated because OpenAI popularized it. &lt;/p&gt;

&lt;p&gt;My opinion:&lt;br&gt;
There are great physics work out there. Giving their core Nobel to CS work is not right. The work is truely impactful but it's not physics core topic. In that sense AI has impact on trading so why not give economy Nobel to them &lt;/p&gt;

&lt;p&gt;References: &lt;br&gt;
Paper: &lt;br&gt;
&lt;a href="https://www.pnas.org/doi/pdf/10.1073/pnas.79.8.2554" rel="noopener noreferrer"&gt;Hopfiled Paper&lt;/a&gt;&lt;br&gt;
&lt;a href="https://proceedings.neurips.cc/paper/2012/file/c399862d3b9d6b76c8436e924a68c45b-Paper.pdf" rel="noopener noreferrer"&gt;Hinton most popular paper&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Videos: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?app=desktop&amp;amp;v=E7B5J4hi0Zk" rel="noopener noreferrer"&gt;Who are the winners actually&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=dR1ncz-Lozc" rel="noopener noreferrer"&gt;You Must Watch Her&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=Arqi1vp68oI" rel="noopener noreferrer"&gt;Yet Another Computerphile&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=piF6D6CQxUw" rel="noopener noreferrer"&gt;Hopfield Network&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=_bqa_I5hNAo" rel="noopener noreferrer"&gt;Generative Model&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;D Marr. Simple memory: a theory for archicortex. Philos Trans R Soc Lond B Biol Sci, 262(841):23–81, July 1971.&lt;/p&gt;

&lt;p&gt;Kaoru Nakano. Associatron-a model of associative memory. IEEE Transactions on Systems, Man, and Cybernetics, SMC-2(3):380–388, 1972. doi: 10.1109/TSMC.1972.4309133.&lt;/p&gt;

&lt;p&gt;S.-I. Amari. Learning patterns and pattern sequences by self-organizing nets of threshold elements. IEEE Transactions on Computers, C-21(11):1197–1206, 1972. doi: 10.1109/T-C.1972.223477.&lt;br&gt;
W.A. Little. The existence of persistent states in the brain. Mathematical Biosciences, 19(1):101–120, 1974. ISSN 0025-5564. doi: &lt;a href="https://doi.org/10.1016/0025-5564(74)90031-5" rel="noopener noreferrer"&gt;https://doi.org/10.1016/0025-5564(74)90031-5&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;J. C. Stanley. Simulation studies of a temporal sequence memory model. Biological Cybernetics, 24(3):121–137, Sep 1976. ISSN 1432-0770. doi: 10.1007/BF00364115.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How Really File Compressors Actually Works</title>
      <dc:creator>Zubair Ahmed Rafi</dc:creator>
      <pubDate>Wed, 25 Sep 2024 13:03:04 +0000</pubDate>
      <link>https://dev.to/mcqueen/how-really-file-compressors-actually-works-ljo</link>
      <guid>https://dev.to/mcqueen/how-really-file-compressors-actually-works-ljo</guid>
      <description>&lt;p&gt;You may have used zip files once in your life.If you have not it's a technique to smaller the size of a file before sending it or storing it.&lt;/p&gt;

&lt;p&gt;In modern ages the need for zip files are less because of the faster internet and free storage capacity.But Method itself can be applied for many things in computer science such a you want store your database but also want to save some space then the methods can be handy &lt;/p&gt;

&lt;p&gt;So today We are going to learn How actually the native file compressor works in our computers &lt;/p&gt;

&lt;p&gt;For clarity zip is one of the method in many other options for file compression. We will walk-through them &lt;/p&gt;

&lt;p&gt;There Are 2 kinds of file compression actually &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Lossy Compression&lt;/li&gt;
&lt;li&gt;Lossless Compression&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Lossy reduce the size of your file but it losses some data which in some cases may not matter &lt;/p&gt;

&lt;p&gt;example: You are watching a youtube video in 4K suddenly the internet speed drops it becomes blurry.Here it losses data while compressing.Note that this kind of compression is very essential for streaming type services &lt;/p&gt;

&lt;p&gt;Lossless reduce the size of your file without losing your data. It uses some algorithm which we are going to discuss to compress and decompress your file &lt;/p&gt;

&lt;p&gt;Example: When you compress a file to make it .zip or .tar.gz file &lt;/p&gt;

&lt;h2&gt;
  
  
  Lossy compression.
&lt;/h2&gt;

&lt;p&gt;Note that based on the usecase the technique can change we are going to talk about the most common one &lt;/p&gt;

&lt;p&gt;Let's analyze a image. If you understand how it works for image you can guess how it works for videos (stream of images) &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7js6edb7ehmjp0kt1eg0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7js6edb7ehmjp0kt1eg0.png" alt="Windows" width="500" height="313"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So this is probably the most views image for computer guys. Now the portion I highlighted kind of share same or similar blue color. So for lossy compression it just replace any variant of it and shows only the fixed color. In this way the file don't need to contain extra information hence the size reduced &lt;/p&gt;

&lt;h2&gt;
  
  
  Lossless Compression
&lt;/h2&gt;

&lt;p&gt;So Now comes the most interesting one lossless compression.&lt;br&gt;
Note: There are many algorithm and format for lossless compression but we will discuss the very basic and common types of them &lt;/p&gt;

&lt;p&gt;The most popular algorithm still now is deflate algortihm which is a mixture of &lt;a href="https://www.youtube.com/watch?v=jVcTrBjI-eE" rel="noopener noreferrer"&gt;LZ77&lt;/a&gt; &amp;amp; &lt;a href="https://www.geeksforgeeks.org/huffman-coding-greedy-algo-3/" rel="noopener noreferrer"&gt;Huffman coding&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For simplicity I will explain the very basic form of this algorithm using an example &lt;/p&gt;

&lt;p&gt;Suppose our file have following text only &lt;/p&gt;

&lt;p&gt;"ABABABA"&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: LZ77 Compression
&lt;/h3&gt;

&lt;p&gt;LZ77 works by finding repeated &lt;a href="https://en.wikipedia.org/wiki/Substring#:~:text=In%20formal%20language%20theory%20and,%22%2C%20but%20not%20a%20substring" rel="noopener noreferrer"&gt;substrings&lt;/a&gt;  and replacing them with pointers to where those substrings appeared earlier. The pointer typically consists of:&lt;/p&gt;

&lt;p&gt;Distance: How far back to look.&lt;br&gt;
Length: How long the repeated substring is.&lt;br&gt;
Let’s compress "ABABABA" using LZ77:&lt;/p&gt;

&lt;p&gt;First three characters "ABA" are unique, so we leave them as they are.&lt;br&gt;
The next two characters "BA" match the pattern found at the beginning. Instead of writing "BA" again, we can create a reference to the earlier "BA".&lt;br&gt;
So, after LZ77, the string is transformed into:&lt;/p&gt;

&lt;p&gt;ABA(3, 2)&lt;/p&gt;

&lt;p&gt;This means:&lt;/p&gt;

&lt;p&gt;"ABA" is written as it is.&lt;br&gt;
The sequence "BA" is replaced by (3, 2), which refers to a match 3 positions back, 2 characters long.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Huffman Coding
&lt;/h3&gt;

&lt;p&gt;Now, we apply Huffman Coding to the result of LZ77. Huffman coding replaces frequently occurring symbols with shorter bit representations. To keep it simple, let's assume we're only compressing characters and using a fixed binary code for them.&lt;/p&gt;

&lt;p&gt;Assume we have the following Huffman codes for the characters:&lt;/p&gt;

&lt;p&gt;A → 0&lt;br&gt;
B → 10&lt;br&gt;
(3,2) → 110&lt;br&gt;
So, after applying Huffman coding to the LZ77 output "ABA(3,2)", we get:&lt;/p&gt;

&lt;p&gt;A → 0&lt;br&gt;
B → 10&lt;br&gt;
A → 0&lt;br&gt;
(3,2) → 110&lt;br&gt;
Now, the compressed output using DEFLATE would be:&lt;/p&gt;

&lt;p&gt;0100110 &lt;br&gt;
&lt;strong&gt;(Note: This seems like it has not lessen the size much but in larger file it will reduce the length in rapid manner)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Final Compression Steps&lt;br&gt;
LZ77 found the repeated substring "BA" and replaced it with a pointer.&lt;br&gt;
Huffman Coding then further compressed the result by encoding the characters and pointer using shorter codes.&lt;/p&gt;

&lt;p&gt;Decompression Process&lt;/p&gt;

&lt;p&gt;Huffman Decoding: Read the bitstream and convert back to characters and LZ77 references.&lt;br&gt;
LZ77 Decompression: Use the distance and length to reconstruct the original data.&lt;/p&gt;

&lt;p&gt;So Now we have the basic algorithm idea of compression.&lt;br&gt;
Now let's explore archieving &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Tar vs Zip&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;So we know how the compression algorithm works but there is still some mystery in archieving them. Say for example we 500 photos Here different compressing software will act differently but we will focus on the most common one for windows(zip) and linux(tar)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Tar (Linux)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;: &lt;br&gt;
Archiving (Pipe Creation):&lt;br&gt;
Tar stands for "Tape Archive." It first bundles files together into a single archive (without compression) in a .tar file. This step preserves file structure and metadata (like creation date, permissions).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;:&lt;br&gt;
Compression:&lt;br&gt;
After creating the archive, you can apply a compression algorithm we discusses but there are more modern version available (like gzip or 7z) to the archive. But the underlying basics are same&lt;/p&gt;

&lt;p&gt;The compressed archive is named tar.gz, tar.bz2, or tar.7z, where the extension indicates the compression method used.&lt;/p&gt;

&lt;p&gt;Advantage of Tar:&lt;/p&gt;

&lt;p&gt;Efficiency: Since it archives first, it compresses all files as one block, leading to better compression for many small files.&lt;/p&gt;

&lt;p&gt;Metadata Preservation: Tar keeps full file metadata like creation dates, permissions, and ownership intact.&lt;/p&gt;

&lt;p&gt;Disadvantage of Tar:&lt;br&gt;
Decompression is All-or-Nothing: You need to decompress the whole archive to access any file within it.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Zip (Windows)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Compress Each File:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Zip compresses each file individually using algorithms like Deflate. It creates a compressed file for each and then combines them into a single .zip file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Merge into Archive:&lt;/strong&gt;&lt;br&gt;
After compressing, zip combines these compressed files into a single archive file. The metadata (file names, structure) is stored alongside the compressed data.&lt;/p&gt;

&lt;p&gt;Advantage of Zip:&lt;/p&gt;

&lt;p&gt;Random Access: You can extract individual files from a .zip file without decompressing the whole archive.&lt;/p&gt;

&lt;p&gt;Cross-Platform: .zip is natively supported on Windows, macOS, and many other systems.&lt;/p&gt;

&lt;p&gt;Disadvantage of Zip:&lt;/p&gt;

&lt;p&gt;Less Compression for Many Files: Since it compresses each file separately, it may not be as efficient for compressing many small files compared to tar.gz.&lt;/p&gt;

&lt;p&gt;Metadata Support: It doesn’t preserve all Unix-specific metadata (like ownership, permissions) as well as tar.&lt;/p&gt;

&lt;p&gt;Among searching 7z is the better and recommended &lt;/p&gt;

&lt;p&gt;One interesting story to wrap up this article &lt;br&gt;
The pioneer zip software pkzip which inspired all the zip softwares was created by phill katz who survived a very struggling life because of some bad habits and also accused of coping the source code of then popular another zip software company.You can follow an video about him in the reference. &lt;/p&gt;

&lt;p&gt;Thanks For Reading &lt;/p&gt;

&lt;p&gt;Ref: &lt;br&gt;
Articles:&lt;br&gt;
&lt;a href="https://zlib.net/feldspar.html" rel="noopener noreferrer"&gt;Deflate Algorithm&lt;/a&gt;&lt;br&gt;
&lt;a href="https://computer.howstuffworks.com/file-compression.htm" rel="noopener noreferrer"&gt;How File compression works&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.toppr.com/guides/computer-science/computer-fundamentals/utility-software/compression-tools/" rel="noopener noreferrer"&gt;Types of file compression&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Videos:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=HNPqWaSEMJI" rel="noopener noreferrer"&gt;Probably Best Video Explanation&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=VPj_dILDK6I&amp;amp;t=49s" rel="noopener noreferrer"&gt;Kind of Talks About All Zip Files Types And The Algorithm They Use&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=1sV-3-vPx3I" rel="noopener noreferrer"&gt;Phil Katz&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=nO27DqT9RCQ" rel="noopener noreferrer"&gt;Tar Vs Zip&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=RV5aUr8sZD0" rel="noopener noreferrer"&gt;Lempel-zip&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=_CItUGbd3dw" rel="noopener noreferrer"&gt;Zip in Linux&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=goOa3DGezUA" rel="noopener noreferrer"&gt;LZ Method&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How Random Are Random Number Generators?</title>
      <dc:creator>Zubair Ahmed Rafi</dc:creator>
      <pubDate>Thu, 11 Jul 2024 14:01:13 +0000</pubDate>
      <link>https://dev.to/mcqueen/how-random-are-random-number-generators-1eid</link>
      <guid>https://dev.to/mcqueen/how-random-are-random-number-generators-1eid</guid>
      <description>&lt;p&gt;Hey Good People &lt;br&gt;
Today lets explore the randomness of random number generator in our computers &lt;/p&gt;
&lt;h1&gt;
  
  
  What is Random Number
&lt;/h1&gt;

&lt;p&gt;So Let's start with a predicting a number and you try to answer it by yourself before reading further &lt;/p&gt;
&lt;h4&gt;
  
  
  Guess a number from 1-10
&lt;/h4&gt;

&lt;p&gt;If you have guessed 7 your like 45% other who would have done that &lt;br&gt;
So does picking 7 make it random ??&lt;/p&gt;

&lt;p&gt;Well a number can't be random , I mean if you say a number and ask me is it random it's not a valid question actually &lt;br&gt;
Randomnees is measured based on a sequence of number &lt;/p&gt;

&lt;p&gt;like if i again ask you to pick a number from 1-10 and you pick 7 would be random , I don't know&lt;br&gt;
But if I asked 100 times and you replied 100 times with 7 then i can safely say its not random &lt;/p&gt;

&lt;p&gt;So I guess we are clear on what is random numbers its basically a sequence of numbers where I can't tell what would be next &lt;/p&gt;
&lt;h1&gt;
  
  
  Our very own Random number generator
&lt;/h1&gt;

&lt;p&gt;So in coding we sometimes need random number. Whats it's application ?&lt;br&gt;
I guess pretty easy application is in Game development like you want to spawn enemies. You just can't spawn them at the same place then the player would get bored . So you need random coordinates for that &lt;br&gt;
Also for lottery ticket allocation or password generator are pretty decent use cases &lt;/p&gt;

&lt;p&gt;Most amazing use cases are in cryptography. I mean when you send messages its need to be encrypted there in encryption random number generator will be needed &lt;/p&gt;

&lt;p&gt;Now we know where random number are needed.But how to generate them &lt;/p&gt;

&lt;p&gt;Each programming language have their own native function and wrapper to generate random number for simplicity we will use only C but in other language basic thinking are the same &lt;/p&gt;
&lt;h1&gt;
  
  
  How random is our random number generator
&lt;/h1&gt;

&lt;p&gt;Most random number generators on computers are actually pseudo-random number generators (PRNGs) Detail explanation in next section. This means they use a mathematical formula to generate a sequence of numbers that appears random, but it's not truly random in the strictest sense. &lt;/p&gt;

&lt;p&gt;Here's the difference:&lt;/p&gt;

&lt;p&gt;True random number generators (TRNGs): These rely on unpredictable physical events like atmospheric noise or radioactive decay to produce randomness. They are more secure and less predictable, but can be slower and more expensive to implement.&lt;br&gt;
Pseudo-random number generators (PRNGs): These are deterministic, meaning they use a formula and an internal state to generate numbers. While the numbers seem random, they can be reproduced if you know the starting state (seed) of the PRNG. These are faster and easier to implement, but not suitable for cryptography or other security-critical applications.&lt;br&gt;
PRNGs are fine for many common uses like games or simulations. However, for things like cryptography where true randomness is essential, TRNGs are the better choice.&lt;/p&gt;
&lt;h1&gt;
  
  
  What is Pseudo Random Number then ?
&lt;/h1&gt;

&lt;p&gt;This example uses the Linear Congruential Generator (LCG) method, a common type of PRNG.&lt;/p&gt;

&lt;p&gt;Formula:&lt;/p&gt;

&lt;p&gt;X_n = (a * X_(n-1) + b) mod m&lt;/p&gt;

&lt;p&gt;Where:&lt;/p&gt;

&lt;p&gt;X_n: The nth random number in the sequence (0 ≤ X_n &amp;lt; m)&lt;br&gt;
a: Multiplier (positive integer, less than m)&lt;br&gt;
b: Increment (non-negative integer, less than m)&lt;br&gt;
m: Modulus (positive integer)&lt;br&gt;
mod: Modulo operation (remainder after division)&lt;br&gt;
Let's see it in action with small values:&lt;/p&gt;

&lt;p&gt;Seed (X_0): 1&lt;br&gt;
Multiplier (a): 2&lt;br&gt;
Increment (b): 1&lt;br&gt;
Modulus (m): 4 (This will limit our random numbers to 0, 1, 2, 3)&lt;br&gt;
Sequence:&lt;/p&gt;

&lt;p&gt;X_1 = (2 * X_0 + b) mod m = (2 * 1 + 1) mod 4 = 3&lt;br&gt;
X_2 = (2 * X_1 + b) mod m = (2 * 3 + 1) mod 4 = 7 (since 7 mod 4 = 3)&lt;br&gt;
X_3 = (2 * X_2 + b) mod m = (2 * 3 + 1) mod 4 = 7 (again, repeats because 7 mod 4 = 3)&lt;br&gt;
Explanation:&lt;/p&gt;

&lt;p&gt;We see the sequence repeats after just 2 steps (X_2 and X_3 are the same).&lt;br&gt;
This is because for this specific choice of parameters (a, b, and m), the generator only produces 2 unique values (0 and 3) before repeating.&lt;br&gt;
Note:&lt;/p&gt;

&lt;p&gt;This is a very basic example. Real-world PRNGs use much larger values for a, b, and m, leading to much longer cycles and more unpredictable sequences.&lt;/p&gt;

&lt;p&gt;So Our Code's Random number generator works like this and acutally are not random at all.&lt;/p&gt;

&lt;p&gt;You can try &lt;a href="https://www.youtube.com/watch?v=-h_rj2-HP2E" rel="noopener noreferrer"&gt;Predict Random Number of JS native random number Generator&lt;/a&gt; to guess JS native random number generator its that easy &lt;/p&gt;
&lt;h1&gt;
  
  
  Then why do we use pseudo random number generator ?
&lt;/h1&gt;

&lt;p&gt;Now if you choose the parameters correctly it will take hours if not days for any computer to predict your next number so in practice its useful as they are serving the purpose. I mean who would try to guess where the next enemy in the game will appear for hours rather than playing the game. &lt;/p&gt;
&lt;h1&gt;
  
  
  How to create true random number then (like for cryptography at least)?
&lt;/h1&gt;

&lt;p&gt;Upon searching I was about to conclude that Its not possible by software but keep reading for the conclusion&lt;/p&gt;

&lt;p&gt;Now true random number can be generated by physical things and can be simulated using code. Like how many electron is emitted from a radioactive element will create randomness. Also the noise of wind is also random&lt;/p&gt;

&lt;p&gt;But how can we use it in our PC's?&lt;br&gt;
Well latest x86 processor allows you to create True Random number&lt;br&gt;
&lt;code&gt;rdrand int _rdrand16_step (unsigned short* val)&lt;/code&gt;&lt;br&gt;
So does cryptrographers uses this kind of method ?&lt;br&gt;
NO&lt;br&gt;
First of all There are services that will give you true random number using physical things like &lt;a href="https://www.random.org/" rel="noopener noreferrer"&gt;API for Random Number Generator&lt;/a&gt;&lt;br&gt;
This api gives you true random number from noise in your side. Pretty cool ha.For simplicity you can assume crypthographical random number also depends on such kind of hardware system, you can also read the reference for more info on it &lt;/p&gt;
&lt;h1&gt;
  
  
  Why can't we use C lang true random number ?
&lt;/h1&gt;

&lt;p&gt;Lets create a pseudo random number in C/C++&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;cstdlib&amp;gt; 
#include &amp;lt;iostream&amp;gt; 
#include &amp;lt;time.h&amp;gt; 
using namespace std; 

int main() 
{ 
    // This program will create different sequence of 
    // random numbers on every program run 

    // Use current time as seed for random generator 
    srand(time(0)); 

    for (int i = 0; i &amp;lt; 4; i++) 
        cout &amp;lt;&amp;lt; rand() &amp;lt;&amp;lt; " "; 

    return 0; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now its pseudo as we have learned rand() does will repeat it self in finite time.&lt;/p&gt;

&lt;p&gt;What if we use &lt;code&gt;rdseed&lt;/code&gt; we can get true random number but the problem is that intel itself demotivate to use it as its distribution is not optimized.&lt;br&gt;
What does it mean well if you again I asked 1000 people to pick a number from 1-100 and plot the results the result may look like below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftmmy76blibdd5v3q703a.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftmmy76blibdd5v3q703a.jpg" alt="Image description" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So its random but you can see its a gaussian distribution so its not predictable but you can guess the number probability of being in that range make it less random &lt;/p&gt;

&lt;p&gt;Intel's built in x86 kind of suggests that there prediction may fall into gaussian distribution.&lt;a href="https://godbolt.org/" rel="noopener noreferrer"&gt;Godbolt&lt;/a&gt;    this website gives you clear idea of how a compiler works on it run the previous code in it and see the magic&lt;/p&gt;

&lt;p&gt;Where the normal random number generator have kind of normal distribution (each have equal probability of appearing) so in that case we can safely use pseudo random number generator for normal purposes&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;In conclusion, while computers cannot generate truly random numbers due to their deterministic nature, pseudo-random number generators (PRNGs) are a powerful tool for many applications. By carefully choosing parameters, PRNGs can produce long and unpredictable sequences of numbers that are sufficient for most purposes, like game development and simulations.&lt;/p&gt;

&lt;p&gt;However, for cryptography and other security-critical applications where true randomness is essential, alternative methods are needed. These can include using hardware-based random number generators (TRNGs) or utilizing online services that gather randomness from physical phenomena.&lt;/p&gt;

&lt;p&gt;Remember, understanding the limitations of PRNGs is crucial for using them effectively. They are a valuable tool, but for true randomness, we need to look beyond the realm of software and into the physical world.&lt;/p&gt;

&lt;p&gt;Ref :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.hypr.com/security-encyclopedia/random-number-generator#:~:text=Random%20number%20generators%20are%20typically,value%20to%20approximate%20true%20randomness." rel="noopener noreferrer"&gt;A classical Movie Explanation of random Number&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=SxP30euw3-0" rel="noopener noreferrer"&gt;How Actually Random Number is Generated&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=aEJB8IAMMpA&amp;amp;t=252s" rel="noopener noreferrer"&gt;Generating True Random Number using C&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=-h_rj2-HP2E" rel="noopener noreferrer"&gt;Predict Random Number of JS native random number Generator&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.shiksha.com/online-courses/articles/rand-and-srand-functions-in-c-programming/#:~:text=The%20srand()%20function%20is,Copy%20code" rel="noopener noreferrer"&gt;Rseed &amp;amp; Rrand&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#ig_expand=5627&amp;amp;cats=Random" rel="noopener noreferrer"&gt;Intel's x86 True Random number generator&lt;/a&gt;&lt;br&gt;
&lt;a href="https://en.wikipedia.org/wiki/RDRAND#Security_issues" rel="noopener noreferrer"&gt;Security Issues for Using that&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.cryptomathic.com/news-events/blog/the-role-of-random-number-generators-in-cryptography" rel="noopener noreferrer"&gt;RNG for cryptography&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
