473,657 Members | 2,490 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

True random device and PHP

Does anyone know how one can get values from the on-chip random device on
modern Intel processors using PHP ? I am using a windows (XP) based system,
PHP 4.3.8

TIA
Pjotr
Jul 17 '05 #1
4 2262
On Sat, 2 Oct 2004 14:17:29 +0200, "Pjotr Wedersteers" <x3****@westert erp.com>
wrote:
Does anyone know how one can get values from the on-chip random device on
modern Intel processors using PHP ? I am using a windows (XP) based system,
PHP 4.3.8


The information on this page:

http://home.comcast.net/~andrex/hardware-RNG/index.html

... came as a bit of a surprise. Looks like Intel have stopped putting
hardware RNGs in their chips.

--
Andy Hassall / <an**@andyh.co. uk> / <http://www.andyh.co.uk >
<http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #2
This is what i am using currently (i always check the DB for dupes first) --

$random = md5 (uniqid (rand()));

I have never had a duplicate alpha-numeric random yet and i am up to 500,000
Phil

Andy Hassall <an**@andyh.co. uk> wrote in message news:<ar******* *************** **********@4ax. com>...
On Sat, 2 Oct 2004 14:17:29 +0200, "Pjotr Wedersteers" <x3****@westert erp.com>
wrote:
Does anyone know how one can get values from the on-chip random device on
modern Intel processors using PHP ? I am using a windows (XP) based system,
PHP 4.3.8


The information on this page:

http://home.comcast.net/~andrex/hardware-RNG/index.html

... came as a bit of a surprise. Looks like Intel have stopped putting
hardware RNGs in their chips.

Jul 17 '05 #3
Andy Hassall wrote:
On Sat, 2 Oct 2004 14:17:29 +0200, "Pjotr Wedersteers"
<x3****@westert erp.com> wrote:
Does anyone know how one can get values from the on-chip random
device on modern Intel processors using PHP ? I am using a windows
(XP) based system, PHP 4.3.8


The information on this page:

http://home.comcast.net/~andrex/hardware-RNG/index.html

... came as a bit of a surprise. Looks like Intel have stopped putting
hardware RNGs in their chips.


I already feared the RNG at least was not going to be widespread. This news
simply deflates any hopes I might have had of using it in my programs.
Thanks for this link Andy.

Pjotr
Jul 17 '05 #4
Phil Palmieri wrote:
This is what i am using currently (i always check the DB for dupes
first) --

$random = md5 (uniqid (rand()));

I have never had a duplicate alpha-numeric random yet and i am up to
500,000

This method is far from random, even when you haven't got one single
duplicate yet.
uniqid () is based on microtime (i.e. predictable) and rand () does not
exceed the range of an integer.
Also rand() which stems from the original libc branch is considered slow and
not very random indeed.

If you need something more random u might check out the mt_rand() function
(mt stands for Mersenne Twister, after the algorithm used for producing
random values).

For good randomness in cardgames sims I need either a true random source or
a pRNG with a range way higher than rand(). Most cardgame sites use advanced
PRNG's mixed with random info such as user mouse movement data, timeout
values et cetera.

Of course all this is not required for simple usage, but for some uses (such
as commercial pokerware) it simply won't do. Thanks for your input too Phil!

Regds
Pjotr
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
11946
by: Nicholas Geraldi | last post by:
Im looking for a decent random number generator. Im looking to make a large number of random numbers (100 or so, if not more) in a short period of time (as fast as possible). the function i was using to get random numbers was Random rn = new Random(System.currentTimeMillis()); but it seems that the system doesn't update the milliseconds often enough to cause a true randomaziation (i ran just the System.currentTimeMillis() in a
21
14162
by: Ron Peterson | last post by:
In the following piece of code, which simply generates a sequence of (random) octal codes, I'm surprised by the apparent non-randomness of /dev/random. It's not noticeable unless RAND_LENGTH is largish. I was under the assumption that /dev/random was "more random" than /dev/urandom, and that it would block if it ran out of entropy until it got more. Why am I seeing so many zeroes in my output? #include <stdio.h> #include <fcntl.h>...
10
1649
by: Curt_C [MVP] | last post by:
If I use it in my page it's fine but when I put it in a Class file for calling it returns the same # for each call. Any ideas why? I'm sure it's something I'll slap myself for but the only samples I can find are for calling the Random() within the page, not a seperate class. --Page-- myClass myclass = new myClass(); for(int i = 1;i <= 100; i++) {
9
8376
by: abhi | last post by:
How do you get random numbers in vb .net? I want random six digit numbers. Cheers, Abhi
1
1350
by: Luis Ramos | last post by:
Happy new year for everybody... My problem is this: I can open a random file with vs2005 this way(normal project), but not in a smart device project. example: Structure Record public ID As Integer public Cod as short
11
12807
by: TreatmentPlant | last post by:
I need to generate a few thousand true random numbers using C++. I have some code now that does alright, but when you plot the results on a graph, you notice patterns, so the numbers are not truly random, but pseudo-random. I tried randomly seeding the seed! to see if that improved things; it didn't. Can anyone help?
13
3185
by: porterboy76 | last post by:
If you only use a 32 bit seed for a random number generator, does that mean you can only ever produce a maximum of 2^32 (approx 4 billion) different sequences? What about the Mersenne Twister, with it's massive period of 2^19937-1. Will you only ever have access to a tiny portion of this ring of numbers, if you only use a 32-bit seed? Will this set of sequences be confined to the beginning of the period, ie, your sequence will have to...
16
7175
by: Claudio Grondi | last post by:
I have a 250 Gbyte file (occupies the whole hard drive space) and want to change only eight bytes in this file at a given offset of appr. 200 Gbyte (all other data in that file should remain unchanged). How can I do that in Python? Claudio Grondi
21
13501
by: chico_yallin | last post by:
I just wana make a random id number based on4 digits-for examples?? Thanks in Advance Ch.Yallin
0
8421
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8325
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8844
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8518
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8621
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1971
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.