Any programmers?

I need some help. I wrote a lottery number generator, but it's missing one final element to generate winning numers. I've been trying to learn programming just to write this. The program that does the heavy lifting is in Python, but I have as well a quantum bit generator in Q# and it computes pseudo random quantum bits when the Q# code is run on my PC. But I want to know how can I set up a Quantum Azure instance, and have Python pass the calls to the Q# qubit function to an Azure instance that uses Microsoft's quantum computers.

Here's a screenshot of my program and it works except the qubits are simulated and not actual qubits. I want to pass a call to an Azure instance that generates actual qubits instead of simulated qubits. Only I don't know how to do it. I'm willing to share it with someone that helps me. I also cast magical spells on it. It should already be powerful only my technical knowledge is lacking.

Specifically, what I need help with is: I don't know how to even set up an Azure quantum instance, and then to actually call it with my Python program. I tried to and failed. I'm really clueless. The whole program is more than 250 lines of code. I'll post some snippets of the code in the replies.

Thalidomide Vintage Ad Shirt $22.14

Unattended Children Pitbull Club Shirt $21.68

Thalidomide Vintage Ad Shirt $22.14

  1. 2 months ago
    Anonymous

    This is the function that handles calls the RNGs and puts the resulting numbers in a list. GenerateRandomBit is a Q# program written by Microsoft to demonstrate qubit generation. I borrowed that code to put in my program since I don't know anything bout qubit generation myself.

  2. 2 months ago
    Anonymous

    Here is the Q# program which works and generate qubits. I'd like to know how I can host this in an Azure instance, or a call from my Python code to an Azure instance that does exactly this.

    • 2 months ago
      Anonymous

      I'm exasperated. All I want to do is call a quantum computer that's like

      AzureQuantumInstance(enter-api-here)
      and then that runs this code

  3. 2 months ago
    Anonymous

    Just go sign up to Azure, log in, click add resource, search for quantum
    It's a fricking wizard
    And Azure has all the documentation and tutorials on it
    Just make a fricking account and log in
    It's right in front of your face

    You do know it costs money though, right?

  4. 2 months ago
    Anonymous

    # requirements:
    # pip install qiskit
    # pip install qiskit-aer
    # creating an account at quantum.ibm.com allows you to use a real quantum computer, either on the web or with python

    from qiskit import QuantumCircuit, Aer, execute

    def run_qasm(qasm_filename, shots=1000):
    #qc = QuantumCircuit.from_qasm_str(qasm_str)
    qc = QuantumCircuit.from_qasm_file(qasm_filename)

    #from qiskit import IBMQ
    #provider = IBMQ.enable_account('APIKEY')
    #for backend in provider.backends():
    # print(backend.name())

    backend = Aer.get_backend("qasm_simulator")

    # Execute the circuit and show the result.
    job = execute(qc, backend, shots=shots)
    result = job.result()
    return result

    def print_result_bits(result):
    counts = result.get_counts()
    print('shots result')
    for count in counts:
    print('%5s %s' % (counts[count], count))

    def draw_circuit(qasm_filename):
    qc = QuantumCircuit.from_qasm_file(qasm_filename)
    #qc.draw(output='mpl') # graphical version using matplotlib
    res = qc.draw(output='text')
    print(res)

    def main(qasm_filename):
    draw_circuit(qasm_filename)
    result = run_qasm(qasm_filename)
    print_result_bits(result)

    import sys

    input_file_name = ""
    if len(sys.argv) >= 2:
    input_file_name = str(sys.argv[1])
    main(input_file_name)
    else:
    print('usage: python quantum.py file.qasm')

  5. 2 months ago
    Anonymous

    that one is for IBM, i get 10 min/mo free

  6. 2 months ago
    Anonymous

    OPENQASM 2.0;
    include "qelib1.inc";
    qreg q[5];
    creg c[3];

    h q[0];
    cx q[0],q[1];

    measure q[0] -> c[0];
    measure q[1] -> c[1];

    • 2 months ago
      Anonymous

      # requirements:
      # pip install qiskit
      # pip install qiskit-aer
      # creating an account at quantum.ibm.com allows you to use a real quantum computer, either on the web or with python

      from qiskit import QuantumCircuit, Aer, execute

      def run_qasm(qasm_filename, shots=1000):
      #qc = QuantumCircuit.from_qasm_str(qasm_str)
      qc = QuantumCircuit.from_qasm_file(qasm_filename)

      #from qiskit import IBMQ
      #provider = IBMQ.enable_account('APIKEY')
      #for backend in provider.backends():
      # print(backend.name())

      backend = Aer.get_backend("qasm_simulator")

      # Execute the circuit and show the result.
      job = execute(qc, backend, shots=shots)
      result = job.result()
      return result

      def print_result_bits(result):
      counts = result.get_counts()
      print('shots result')
      for count in counts:
      print('%5s %s' % (counts[count], count))

      def draw_circuit(qasm_filename):
      qc = QuantumCircuit.from_qasm_file(qasm_filename)
      #qc.draw(output='mpl') # graphical version using matplotlib
      res = qc.draw(output='text')
      print(res)

      def main(qasm_filename):
      draw_circuit(qasm_filename)
      result = run_qasm(qasm_filename)
      print_result_bits(result)

      import sys

      input_file_name = ""
      if len(sys.argv) >= 2:
      input_file_name = str(sys.argv[1])
      main(input_file_name)
      else:
      print('usage: python quantum.py file.qasm')

      What am I looking at?

  7. 2 months ago
    Anonymous

    Also how do you think you're going to predict a lottery when all you are doing is generating random numbers?

  8. 2 months ago
    Anonymous

    You will probably need to do a web request to the instance and get the response.

    • 2 months ago
      Anonymous

      I'm going to try creating another Azure quantum instance again. I probably didn't set it up correctly the first time.

  9. 2 months ago
    Anonymous

    If the question is technology-related shouldn't it be on a technology board? In any case, I didn't know quantum computers were already available for use. that's nice.
    The idea is since the algorithms rely on quantumness they're truly random, so more propense to magic?

    • 2 months ago
      Anonymous

      Well it's related to both, because trying to predict lottery numbers is /x/ related. More people on /x/ are going to be interested in this than EerieWeb. The program is just a tool and a means to an end.

      • 2 months ago
        Anonymous

        >The program is just a tool and a means to an end.
        That's fair, but if what you're having trouble now is building the program, you might get better luck asking on a technology forum/board/w.e.
        If you're asking here it depends on whether there is someone both into divination AND programming/azure browsing.

  10. 2 months ago
    Anonymous

    The Azure instance is deploying. It's getting more complicated.

    • 2 months ago
      Anonymous

      I don't know what to do from here.

    • 2 months ago
      Anonymous

      https://i.imgur.com/8tOsY9B.png

      I'm going to try creating another Azure quantum instance again. I probably didn't set it up correctly the first time.

      And here, no idea where to go from here, or what actual code I should try to run on the instance.

      • 2 months ago
        Anonymous

        https://i.imgur.com/02pyCKX.png

        I found Azure CLI, and maybe this could work to call the Azure instance with my Python code. But I'm not sure how.
        https://learn.microsoft.com/en-gb/cli/azure/install-azure-cli-windows?tabs=azure-cli

        It won't work with a Jupyter Notebook which I saw an option for using with an Azure instance, because that won't run the GUI I'm using for the program.

        The online VSCode to run an Azure instance option also won't work because it won't run the GUI, and it won't run Python code, only Q# code.

        So from what I can tell only local development and Azure CLI is suitable for my purposes but there's like a million commands with this CLI. Using it is done with local development. which is the advanced option unfortunately. So I'm even more confused now and don't even know how to get started with Azure CLI.

        I'm trying to get an Azure instance running that generates qubits

        YOU SEE THOSE BIG THREE FRICKING BUTTONS?

        FRICKING CLICK ONE AND IT WILL SEND YOU STRAIGHT TO THE FRICKING QUANTUM COMPUTER YOU FRICKING IDIOT

        click open vs code (web) and it will open an ide you can put your code in to run

        jesus fricking christ

  11. 2 months ago
    Anonymous

    you're thusfar just generating random numbers. what part of this specifically is supposed to produce winning numbers?

    • 2 months ago
      Anonymous

      I found Azure CLI, and maybe this could work to call the Azure instance with my Python code. But I'm not sure how.
      https://learn.microsoft.com/en-gb/cli/azure/install-azure-cli-windows?tabs=azure-cli

      It won't work with a Jupyter Notebook which I saw an option for using with an Azure instance, because that won't run the GUI I'm using for the program.

      The online VSCode to run an Azure instance option also won't work because it won't run the GUI, and it won't run Python code, only Q# code.

      So from what I can tell only local development and Azure CLI is suitable for my purposes but there's like a million commands with this CLI. Using it is done with local development. which is the advanced option unfortunately. So I'm even more confused now and don't even know how to get started with Azure CLI.

      I'm trying to get an Azure instance running that generates qubits

      • 2 months ago
        Anonymous

        https://github.com/microsoft/azure-quantum-python

        • 2 months ago
          Anonymous

          This may be what I need.

          [...]
          YOU SEE THOSE BIG THREE FRICKING BUTTONS?

          FRICKING CLICK ONE AND IT WILL SEND YOU STRAIGHT TO THE FRICKING QUANTUM COMPUTER YOU FRICKING IDIOT

          click open vs code (web) and it will open an ide you can put your code in to run

          jesus fricking christ

          The issue with the VSCode environment is that my program is 99% Python and the web client won't execute Python code, only Q# code. There is a feature with my local VSCode client to connect to an online workspace, and if I connected my local VSCode IDE with Python code in it, to an online workspace with Q# code, that would work. So my Python code would execute locally, and make calls to the online workspace containing the Q# code. But I don't know how.

          • 2 months ago
            Anonymous

            oh derp
            do jupyter
            that is python

            i mean it does fricking say it right fricking there
            have you even read the pictures you posted

          • 2 months ago
            Anonymous

            Jupyter won't run the GUI I made. I explained the problems in this post with the web client and Jupyter and why I can't use them.

            https://i.imgur.com/02pyCKX.png

            I found Azure CLI, and maybe this could work to call the Azure instance with my Python code. But I'm not sure how.
            https://learn.microsoft.com/en-gb/cli/azure/install-azure-cli-windows?tabs=azure-cli

            It won't work with a Jupyter Notebook which I saw an option for using with an Azure instance, because that won't run the GUI I'm using for the program.

            The online VSCode to run an Azure instance option also won't work because it won't run the GUI, and it won't run Python code, only Q# code.

            So from what I can tell only local development and Azure CLI is suitable for my purposes but there's like a million commands with this CLI. Using it is done with local development. which is the advanced option unfortunately. So I'm even more confused now and don't even know how to get started with Azure CLI.

            I'm trying to get an Azure instance running that generates qubits

            or click the 3rd button and learn how to do it from your computer

            which is what I'm trying to figure out.

          • 2 months ago
            Anonymous

            jupyter is a gui
            just print all your results

  12. 2 months ago
    Anonymous

    If anyone is familiar with using Azure instances, or deploying them please email me. I can even pay if someone can get my code running on a quantum computing instance. Or pay if your help makes me figure this out. I've been working on this program for months now. I'm going to sleep but I'll leave this thread open and here is my email

    [email protected]

  13. 2 months ago
    LIAR(Insert the D)

    Describe what you mean by "generate winning numers." (numbers I assume).

    Are you trying to create a program that will declare what the winning numbers shall be on a particular draw date?

    Or are you trying to create a program the will retrieve "ahead of time" information? That will get whatever the winning numbers will be on a particular drawing date?

    Be honest in which one of these you had considered up until reading this post: either one of them, both of them, or neither.

    • 2 months ago
      Anonymous

      I believe quantum bits can get information I don't have from somewhere, or from some time. My hope is the numbers generated from quantum bits will be weighted toward actual winning numbers.

      • 2 months ago
        Anonymous

        > I believe quantum bits can get information I don't have from somewhere, or from some time.
        They don’t so correct that belief and you can stop wasting time.

  14. 2 months ago
    Anonymous

    or click the 3rd button and learn how to do it from your computer

Your email address will not be published. Required fields are marked *