xref: /third_party/musl/src/prng/rand.c
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/musl/src/prng/
1570af302Sopenharmony_ci#include <stdlib.h>
2570af302Sopenharmony_ci#include <stdint.h>
3570af302Sopenharmony_ci
4570af302Sopenharmony_cistatic uint64_t seed;
5570af302Sopenharmony_ci
6570af302Sopenharmony_civoid srand(unsigned s)
7570af302Sopenharmony_ci{
8570af302Sopenharmony_ci	seed = s-1;
9570af302Sopenharmony_ci}
10570af302Sopenharmony_ci
11570af302Sopenharmony_ciint rand(void)
12570af302Sopenharmony_ci{
13570af302Sopenharmony_ci	seed = 6364136223846793005ULL*seed + 1;
14570af302Sopenharmony_ci	return seed>>33;
15570af302Sopenharmony_ci}
16

Indexes created Thu Nov 07 10:32:03 CST 2024