I see you reported this as solved. But you indicate here it's not working with the lfsr?
That is pretty much the same as doing a right shift by 39 (arbitrarily moving the decimal point to the left end of the number). The problem with using an lfsr is you can never get a value of 0 as that is the stuck state of the lfsr also you can never have 1 as that would mean there would have to be values generated with a '1' to the left of the decimal point (i.e. a 40-bit value). Therefore an lfsr can only generate values between 0 < lfsr < 1.
But the good news is: taking these 39-bits directly as output and expecting a sequence that is even remotely decently random is rather ... optimistic. So all the above does not even get a chance of becoming a problem. Because other problems get in the way first.
Because while the OP
says it is a 39-bit random number, it's not. What you have there is a 39-bit LFSR, that is generating a sequence of 1-bit random numbers. There's a difference between the two.
If you don't believe me ... seed it with whatever seed you like (well apart from the stuck state
), and then lets say 10K simulation steps and take your 39-bit "random" number. Then compute the cross correlation between the sequence and delayed versions of itself. A proper random sequence has very low correlation. This 39-bit number sequence has correlation galore. Why? Two words: shift register.
That is why you can only use 1-bit output. If you want more, then addition steps are required.
Anyways, normal distribution is fairly easy. If you want an N-bit uniformly distributed number, you clock out N bits from that 39-bit LFSR. One bit at a time. So it will take you N clock cycles to get that number.
If you want multiple bits in one clock, either use multiple LFSR's in parallel, or use leap ahead.