Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int seed;
- void _srand(int x) {
- seed = x;
- }
- int _rand(){
- return (((seed = seed * 214013L + 2531011L) >> 16) & 0x7fff);
- }
- int main(){
- srand(123);
- for (int i = 0; i < 10;i++) printf("%d ", rand());
- puts("");
- _srand(123);
- for (int i = 0; i < 10;i++) printf("%d ", _rand());
- puts("");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement