| От | gateley@jriver.com |
|---|---|
| Тема | Re: Still wondering about random numbers... |
| Дата | |
| Msg-id | 3B701A40.B0EC1685@jriver.com обсуждение исходный текст |
| Ответ на | Still wondering about random numbers... ("Dr. Evil" <drevil@sidereal.kz>) |
| Список | pgsql-general |
Joe Conway wrote: > > > I am running on OpenBSD and Linux, both of which have > > cryptographic-quality RNGs built in. When I call RANDOM() in PG, do I > > get the old C library random numbers, which are not very random, or do > > I get high-quality random numbers from the crypto-RNG that's built in? > > Any sugestions for getting high-quality random numbers? > > Looking through the source, I find: > result = ((double) random()) / ((double) MAX_RANDOM_VALUE); The random() function returns better (good?) random numbers. The rand() function returns poor random numbers. random() also depends on how much state it is initialized with (and may or may not be based on /dev/random, I don't know). j
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера