Jump to content
43oh

MochaSatin

Members
  • Content Count

    2
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MochaSatin

  1. Here is a small code snippet for the linear congruential generator. Adjust for you needs: #include int main() { int M = 256; int a = 65; int c = 27; int X = 1; int i; for(i=0; i<256; i++) { X=(a * X + c) % M; printf("%d ", X); } return 0; } Output: 92 119 82 237 72 99 62 217 52 79 42 197 32 59 22 177 12 39 2 157 248 19 238 137 228 255 218 117 208 235 198 97 188 215 178 77 168 195 158 57 148 175 138 37 128 155 118 17 108 135 98 253 88 115 78 233 68 95 58 213 48 75 38 193 28 55
  2. There is a simple procedure for calculating random numbers using integers. Look into Linear Congruential Generator.
×
×
  • Create New...