memesearch
Bad Luck Random Number Generator

Bad Luck Random Number Generator

Download Find similar pictures
Text on the meme
I'm trying to generate a random int that is either 0 or 1 in C++. Right now, I receive a 0 every time I run this code, and I'm not sure why. What's the problem here? #include <ctime> #include <cstdlib> srand(time(0)); int randomval = rand() % 2; cout << randomval << endl; 8 Answers It is called bad luck. Try it again.
What it means

A Stack Overflow screenshot shows a question about a C++ program that keeps generating 0 instead of randomly producing 0 or 1. The punchline answer says, “It is called bad luck. Try it again,” humorously treating a programming issue as mere bad luck. EN: A Stack Overflow screenshot shows a question about a C++ program that keeps generating 0 instead of randomly producing 0 or 1. The punchline answer says, “It is called bad luck. Try it again,” humorously treating a programming issue as mere bad luck.

Objects
Tags
Source
Template
Stack Overflow screenshot
Type
image
Size
763×594 · 43.0 KiB
Mood
sarcastic
Language
en
Added