C++ (Qt) const int rand_max = 100000000; std::mt19937 gen; std::uniform_int_distribution<int> dist(0, rand_max); std::cout << dist(gen) << std::endl;
C++ (Qt)#define RAND_MAX 0x7FFFFFFF
C++ (Qt)inline quint32 RandInt( void ){ return (qrand() << 16) | qrand();}
C++ (Qt)void RandSeed( quint32 & seed ) { seed = (qint32)(seed) * 1103515245 + 12345;}
C++ (Qt)double RandSeedF( quint32 & seed ) { RandSeed(seed); // как выше return seed * 2.328306436E-10f;}
C++ (Qt)#include "widget.h"#include "ui_widget.h" #include <QMessageBox>#include <QFileDialog> Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget){ ui->setupUi(this); QObject::connect(ui->pushButton_1, SIGNAL(clicked()), this, SLOT(MyEventButton_1())); } Widget::~Widget(){ delete ui;} // нажатие кнопкиvoid Widget::MyEventButton_1(){ int x; QString str; QMessageBox msgBox; /* str = QFileDialog::getOpenFileName(this, tr("Open File"), "C:/temp/", tr("*"));*/ for(int i = 0; i < 10; i++) { x = qrand(); msgBox.setText(QString::number(x)); msgBox.exec(); } return;}