Aleksandr Lenin on Wed, 28 Mar 2018 13:48:06 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Random bitstring generation in PARI library
|
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: Random bitstring generation in PARI library
- From: Aleksandr Lenin <aleksandr.lenin@cyber.ee>
- Date: Wed, 28 Mar 2018 14:47:58 +0300
- Autocrypt: addr=aleksandr.lenin@cyber.ee; keydata= xsFNBFg+zhcBEADDEV0vMCFAkMGPnaEqsa4JnTUIGPrQvVkp5hCyVwTgHOzDTw4x3FljwbJ9 BoVI9V3d9j9OdxM6WSKlinjf7ZDFajzRo+O1aevXuJNAdXyWsCfdgKP9zsxcdf2pcgkTSh4j I2fFkjndylGYPrSbKFLdZz+SngY+wXAEQ1CcKSAmwm2Gd5qqXgjErIFtvRtcRnH+0z4/Hbw0 5BPASCpdmrfu/ALvM6YWi4Bskqz6TAtsFdqJV1MpWBwU56CdLgt3q8SOoBOzJBIF329OPW/O BIXdByfeA4Z7HVLLjQM/D5CPRvjBRJw5tfTd5dAH30uJDF3C88DE4mpZrR8dRrSuFhBEacSO MU6UoBm8q3V6yeRv9zQENDBXa+StTTOYKR2DI+7pLFzfYBRMu18IdgPoG7Vyzo9T+SSvRkb/ csGS7uwpwzNXLQ7GM4xAguBmlWUBWuJRH+t5+zPJ9a2k9bYpwos72PkPGdss4/xDu/d9p04Z xkXLj3RbPWac8B6wxkt6spuDni8W1N2KIDV8Gbe5wDzEns/ebVaH/oSC0UZaDQVW2ye4jCpL hnn7K23FBGe6xwiD8RzIEHkrTv/M2XoLvt0vkNouquliZSRmLfJA11M+50kOhdd+GntLhob0 zZjYhxv7pJjGW10XpqDE4tP205zrjU/oyn5XQY7IMDrbjCJT3wARAQABzSpBbGVrc2FuZHIg TGVuaW4gPGFsZWtzYW5kci5sZW5pbkBjeWJlci5lZT7CwX0EEwEIACcFAlg+zhcCGyMFCQlm AYAFCwkIBwIGFQgJCgsCBBYCAwEC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5TJhNf8=
- Delivery-date: Wed, 28 Mar 2018 13:48:06 +0200
- In-reply-to: <20180327182910.GD31171@yellowpig>
- Openpgp: preference=signencrypt
- References: <c6331172-2c37-0751-0f33-636e4355ff9e@cyber.ee> <20180327182910.GD31171@yellowpig>
- User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0
On 03/27/2018 09:29 PM, Bill Allombert wrote:
> On Tue, Mar 27, 2018 at 02:41:46PM +0300, Aleksandr Lenin wrote:
>> Hello,
>>
>> what is the procedure to generate a random k-bit number, where k is
>> greater than BITS_IN_LONG?
>
> In GP, random(2^k)
>
>> Reading through the manual
>> (https://pari.math.u-bordeaux.fr/pub/pari/manuals/2.10.0/libpari.pdf) I
>> managed to find only pari_rand, random_bits, random_Fl which return an
>> (unsigned) long, and I need a bigger number. The function randomi indeed
>> returns a GEN, but in the range 1..p-1, but I need a random bitstring of
>> length k.
>
> In C you can do randomi(int2n(k))
this would return me a number in the range [0,2^k-1], this is not
exactly what I need. I would like to be able to generate numbers of
k-bit length only.
>
> Cheers,
> Bill.
>
--
With kind regards,
Aleksandr