コード例 #1
0
static QByteArray messageId(const QByteArray& domainName, quint32 addressComponent)
{
    static bool rngInitialised(initialiseRng());
    Q_UNUSED(rngInitialised)

    quint32 randomComponent(static_cast<quint32>(qrand()));
    quint32 timeComponent(QDateTime::currentDateTime().toUTC().toTime_t());

    return ('<' +
            QString::number(randomComponent, 36) + 
            '.' +
            QString::number(timeComponent, 36) +
            '.' +
            QString::number(addressComponent, 36) +
            "-qmf@" +
            domainName +
            '>').toLatin1();
}
コード例 #2
0
ファイル: Graph2.cpp プロジェクト: paulpela/frequencies
GLfloat Graph2::graphFunction(GLfloat x) {
    GLfloat output = 0.0f;

    output += sin(x / 32.0f) * 10.0f;
    output += randomComponent() * 8.0f;

    if(x > 100.0f && x < 200.0f) {
        output += glm::smoothstep(0.0f, 100.0f, x - 100.0f) * 100.0f;
    }

    if(x >= 200.0f && x < 500.0f) {
        output += glm::smoothstep(100.0f, 0.0f, x - 200.0f) * 100.0f;
    }

    output += sin(x - 3.0f) * 10.0f;

    if(x > 800.0f && x < 1000.0f) {
        output -= glm::smoothstep(0.0f, 200.0f, x - 800.0f) * 100.0f;
    }

    output += SCREEN_Y / 2.0f - 200.0f;

    return output;
}