# Parameter that gives the maximum cycle

39 views

### Hal Dosen

Oct 31, 2021, 6:08:43 AM10/31/21
to prng
How do you determine the parameters that would give the maximum cycle in xoroshiro?

For example, what is the parameter that gives the maximum cycle in xoroshiro16++?

### Jsknkj RNG

Oct 31, 2021, 6:30:02 AM10/31/21
to prng
Disambiguate xoroshiro16++. Is it xoroshiro[8]16++ (two 8-bit integers), xoroshiro[4]16++ (four 4-bit integers), or xoroshiro[2]16++ (eight 2-bit integers)?

### Hal Dosen

Oct 31, 2021, 8:24:37 AM10/31/21
to prng
What I am is xoroshiro[8]16++ (two 8-bit integers).

My c code is here.

#include <stdint.h>
#include <stdio.h>

static inline uint8_t rotl(const uint8_t x, int k) {
return (x << k) | (x >> (8 - k));
}

static uint8_t s[2];

void seed(const uint8_t s0, const uint8_t s1){
s[0] = s0;
s[1] = s1;
}

uint8_t next(void) {
const uint8_t s0 = s[0];
uint8_t s1 = s[1];
const uint8_t result = rotl(s0 + s1, a) + s0;  //a

s1 ^= s0;
s[0] = rotl(s0, b) ^ s1 ^ (s1 << c); //  b, c
s[1] = rotl(s1, d); // d
return result;
}

int main(void){
uint8_t s0 = 1;
uint8_t s1 = 3;

seed(s0, s1 + 1);

uint8_t r;
r = next();
printf("%u\n",r);
return 0;
}

I don't know what to set abcd to to get the maximum cycle.

As a side note, am I right in thinking that the maximum cycle of xoroshiro16++ is 2^16-1?

2021年10月31日日曜日 19:30:02 UTC+9 uiopzx...@gmail.com: