| 312 | //========================================================================== |
| 313 | |
| 314 | void FRandom::StaticReadRNGState(FSerializer &arc) |
| 315 | { |
| 316 | FRandom *rng; |
| 317 | |
| 318 | arc("rngseed", rngseed); |
| 319 | |
| 320 | // Call StaticClearRandom in order to ensure that SFMT is initialized |
| 321 | FRandom::StaticClearRandom (); |
| 322 | |
| 323 | if (arc.BeginArray("rngs")) |
| 324 | { |
| 325 | int count = arc.ArraySize(); |
| 326 | |
| 327 | for (int i = 0; i < count; i++) |
| 328 | { |
| 329 | if (arc.BeginObject(nullptr)) |
| 330 | { |
| 331 | uint32_t crc; |
| 332 | arc("crc", crc); |
| 333 | |
| 334 | for (rng = FRandom::RNGList; rng != NULL; rng = rng->Next) |
| 335 | { |
| 336 | if (rng->NameCRC == crc) |
| 337 | { |
| 338 | arc("index", rng->idx) |
| 339 | .Array("u", rng->sfmt.u, SFMT::N32); |
| 340 | break; |
| 341 | } |
| 342 | } |
| 343 | arc.EndObject(); |
| 344 | } |
| 345 | } |
| 346 | arc.EndArray(); |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | //========================================================================== |
| 351 | // |
nothing calls this directly
no test coverage detected