Sketch that displays two random binary numbers

Hello,
I'm new to coding on the Arduino and need help with getting two random binary numbers. Do I find random integers then convert to binary, or is there a way to just randomize binary numbers? Any help would be appreciated.
Thanks!

To the Arduino, all numbers are binary.
Have you tried using rand?

I just realized that, but how do I display only 2 of the random binary numbers? Also, how what is the code to add binary numbers on the Arduino? Thanks a lot.

arduinocoding95:
I just realized that, but how do I display only 2 of the random binary numbers? Also, how what is the code to add binary numbers on the Arduino? Thanks a lot.

The code to add two binary numbers uses the '+' operator.
If you only want to display two numbers, then all you do is print two of the numbers.

what is the code to add binary numbers on the Arduino?

sum = a + b;

how do I display only 2 of the random binary numbers?

Serial.println(random(max));
Serial.println(random(max));

There are 10 types of people - this who understand how to add binary numbers, and those who don't

jremington:

sum = a + b;
Serial.println(random(max), BIN);

Serial.println(random(max,BIN));

Thanks for the replies guys! I don't think you are understanding my issue, though. I need to take two random integers, and that's it. I'm unsure how to make it stop after compiling once. Another issue I'm having is asking the user what the answer is to the addition problem, and telling them they are correct or incorrect. I don't want to show them the answer until they have answered it correctly. If anyone can help by using my code it would be much appreciated!!

long randANumber;
long randBNumber;
int a;
int b;

void setup()
{
  Serial.begin(9600);
  randomSeed(analogRead(0)); 
}

void loop()
{
  randANumber = random(100);
  randBNumber = random(100);
  int a = randANumber;
  int b = randBNumber;
  
  Serial.print("a = ");
  Serial.println(randANumber,BIN);
  Serial.print("b = ");
  Serial.println(randBNumber,BIN);
 
  delay(1000);
  
  Serial.println("What is the addition of a and b?");
}

If you don't want code to repeat (aka loop) put the code in setup, which runs only once.

How do I have the user answer the question with the answer not being shown but the code already knows it?

??

How do I ask the user "what is a+b" and unless they give the correct answer, tell them "incorrect try again" until the correct answer is given?

Perhaps surprisingly, that is not a simple beginner's project. You will need to learn how to process input from the serial monitor.

If you want to learn how to do it, start here, with Serial Input Basics.

Or, search for the web for a working example.