I_Interface
Ludovic 'Archivist'
Ludovic 'Archivist'
Also, it is worth noting that *std::vector<bool> works differently compared to other template<typename T> std::vector*
数学の恋人
数学の恋人
Ludovic 'Archivist'
Like?
It is allowed to store 8 booleans per byte or any setup it likes for storing the booleans given that they are still in contiguous memory
数学の恋人
is nature a keyword in C++?
数学の恋人
ok it's not
scammer.xyz
Anybody know any idea to use c programming sockets to communicate with multiple client vice versa?
scammer.xyz
Using TCP protocol
Dima
yes
scammer.xyz
Communicate with 1 client at the time is easy
Dima
take a look on long polling
Wim
Probably he's having the issue he's responding on the port being connected to, making it unavailable to other clients
Wim
You know, Emile, you can respond from a different port on the request to keep the host-port open for multiple connections?
数学の恋人
#include <iostream>
int main()
{
char letters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char oletters[] = "0123456789";
char random_name[5];
for(int i = 0; i < 5; i++)
{
switch(i)
{
case 0: random_name[i] = letters[rand() % 26]; break;
case 1: random_name[i] = letters[rand() % 26]; break;
case 2: random_name[i] = oletters[rand() % 10]; break;
case 3: random_name[i] = oletters[rand() % 10]; break;
case 4: random_name[i] = oletters[rand() % 10]; break;
default: break;
}
}
std::cout << "Random name thus generated is: " << random_name;
return 0;
}
Please check is this program correct?
I_Interface
数学の恋人
Well I did
数学の恋人
I'm not getting expected results
I_Interface
I_Interface
and watch where it goes wrong
数学の恋人
But I was supposed to get something lke
BS123 etc. etc.
数学の恋人
数学の恋人
I'm using vim not an ide
I_Interface
hm
数学の恋人
is radare good?
数学の恋人
radare2
I_Interface
is radare good?
i didn't work with linux, sry)
don't know it)
数学の恋人
Oh
Decoder_3d
So best ide is ?
akaWolf
mrphyber
mrphyber
I use it too
Anonymous
👍
Хамза
Mihail
So cout prints it until the \0 and so you get random values after NW753 which is what your program generated
Mihail
Also that code is kinda bad
Mihail
Use 2 for's and remove the switch
Mihail
Would be way better
Mihail
Oh and seeing it's C++, just use std::string
Mihail
And rand isn't good for generating random numbers, because it's not a uniform distribution
Anonymous
yes when i tried creating a game, everytime rand gives same order of numbers.🙄
Nikolas
Rostin
That might be a seed problem
Nikolas
I mean, rand is not good, but it doesn't always give the same order 😆
Anonymous
Rostin
Check what Nikolas said
Anonymous
Nikolas
https://en.cppreference.com/w/cpp/numeric/random/srand
Nikolas
(while the fact that rand() is not good stays true, of course)
Rostin
A "better" std alternative if mt19937
Anonymous
ok will check it out . Thanks
When I googled it earlier it shows it follows a complete pattern of execution which produces same output everytime
Nikolas
srand() initializes the sequence of pseudo-random numbers that rand() gives. If you don't use srand(), it will always use 1 as seed number, so you will get always the same order
Nikolas
(this might be useful if, for example, you want to debug a program which uses rand(), since you will remove randomness from your code)
Mihail
I_Interface
Mihail
And put it in a uniform distribution
TuF
TuF
Output?
IM
Hello everyone! I'm looking for anyone who have experience with reSIProcate, is there any1?
Mihail
Nikolas
Anonymous
Mihail
Anonymous
Mihail
And then the mt19937 in a uniform distribution
Rostin
Mt19937 stands for mersenne twister
Anonymous
these things are in which library?🙄
Mihail
TuF
TuF
Anonymous
Mihail
Well here's your answer
Kk
I want a personal programming tutor...anyone intrested?