Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  prandom.h   Sprache: C

 
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __TOOLS_LINUX_PRANDOM_H
#define __TOOLS_LINUX_PRANDOM_H

#include <linux/types.h>

struct rnd_state {
 __u32 s1, s2, s3, s4;
};

/*
 * Handle minimum values for seeds
 */

static inline u32 __seed(u32 x, u32 m)
{
 return (x < m) ? x + m : x;
}

/**
 * prandom_seed_state - set seed for prandom_u32_state().
 * @state: pointer to state structure to receive the seed.
 * @seed: arbitrary 64-bit value to use as a seed.
 */

static inline void prandom_seed_state(struct rnd_state *state, u64 seed)
{
 u32 i = ((seed >> 32) ^ (seed << 10) ^ seed) & 0xffffffffUL;

 state->s1 = __seed(i,   2U);
 state->s2 = __seed(i,   8U);
 state->s3 = __seed(i,  16U);
 state->s4 = __seed(i, 128U);
}

/**
 * prandom_u32_state - seeded pseudo-random number generator.
 * @state: pointer to state structure holding seeded state.
 *
 * This is used for pseudo-randomness with no outside seeding.
 * For more random results, use get_random_u32().
 */

static inline u32 prandom_u32_state(struct rnd_state *state)
{
#define TAUSWORTHE(s, a, b, c, d) (((s & c) << d) ^ (((s << a) ^ s) >> b))
 state->s1 = TAUSWORTHE(state->s1,  6U, 13U, 4294967294U, 18U);
 state->s2 = TAUSWORTHE(state->s2,  2U, 27U, 4294967288U,  2U);
 state->s3 = TAUSWORTHE(state->s3, 13U, 21U, 4294967280U,  7U);
 state->s4 = TAUSWORTHE(state->s4,  3U, 12U, 4294967168U, 13U);

 return (state->s1 ^ state->s2 ^ state->s3 ^ state->s4);
}
#endif // __TOOLS_LINUX_PRANDOM_H

Messung V0.5
C=95 H=98 G=96

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge