CrypticKiwi Posted November 20, 2015 Share Posted November 20, 2015 (edited) Hello guys, I am working on a project that involves random numbers and wanted to conduct some tests to test the random numbers randomness. I stumbled upon random.org bitmap generator and I became interested in looking at a bitmap of my random numbers file to check for obvious patterns but unfortunately random.org does not provide the program for download just to use on their site.It should be something like this Link but I want the bitmap to be generated from a file on my hard drive instead.Searching a little bit more I found this Article about a similar topic in which a script fetches random numbers from random.org and converts them to bitmaps for pattern analysis And provided the R code for it. So can anyone with the knowledge of R help me convert his code from R to Autoit? if its even possible...A simpler .NET code Link but im not sure if plotting technique is the same or different. If its just simple plotting techniques on both articles, then I guess I can do it myself with some help/pointers from you guys. Edited November 20, 2015 by CrypticKiwi Link to comment Share on other sites More sharing options...
UEZ Posted November 20, 2015 Share Posted November 20, 2015 I didn't read the R code but this generates also a random bitmap:#include <GDIPlus.au3> _GDIPlus_Startup() Global $fTimer = TimerInit() Global Const $hImage = _GDIPlus_BitmapCreateGreyscaleFromRandom() Global Const $fEndTime = Round(TimerDiff($fTimer), 2) ConsoleWrite("Bitmap created in " & $fEndTime & " ms." & @CRLF) _GDIPlus_ImageSaveToFile($hImage, @ScriptDir & "\Random.png") _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() ShellExecute(@ScriptDir & "\Random.png") Func _GDIPlus_BitmapCreateGreyscaleFromRandom($iW = 500, $iH = 500) Local Const $hImage = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $tBitmapData = _GDIPlus_BitmapLockBits($hImage, 0, 0, $iW, $iH, $GDIP_ILMWRITE, $GDIP_PXF32RGB) Local $iScan0 = DllStructGetData($tBitmapData, "Scan0") Local $tPixel = DllStructCreate("int Image[" & $iW * $iH & "];", $iScan0) Local $iX, $iY, $iRandom, $iRowOffset For $iY = 0 To $iH - 1 $iRowOffset = $iY * $iW + 1 For $iX = 0 To $iW - 1 $iRandom = Random(0, 0xFF, 1) DllStructSetData($tPixel, 1, 0xFF000000 + 0x10000 * $iRandom + 0x100 * $iRandom + $iRandom, $iRowOffset + $iX) Next Next _GDIPlus_BitmapUnlockBits($hImage, $tBitmapData) Return $hImage EndFunc CrypticKiwi 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
CrypticKiwi Posted November 20, 2015 Author Share Posted November 20, 2015 (edited) I didn't read the R code but this generates also a random bitmap:#include <GDIPlus.au3> _GDIPlus_Startup() Global $fTimer = TimerInit() Global Const $hImage = _GDIPlus_BitmapCreateGreyscaleFromRandom() Global Const $fEndTime = Round(TimerDiff($fTimer), 2) ConsoleWrite("Bitmap created in " & $fEndTime & " ms." & @CRLF) _GDIPlus_ImageSaveToFile($hImage, @ScriptDir & "\Random.png") _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() ShellExecute(@ScriptDir & "\Random.png") Func _GDIPlus_BitmapCreateGreyscaleFromRandom($iW = 500, $iH = 500) Local Const $hImage = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $tBitmapData = _GDIPlus_BitmapLockBits($hImage, 0, 0, $iW, $iH, $GDIP_ILMWRITE, $GDIP_PXF32RGB) Local $iScan0 = DllStructGetData($tBitmapData, "Scan0") Local $tPixel = DllStructCreate("int Image[" & $iW * $iH & "];", $iScan0) Local $iX, $iY, $iRandom, $iRowOffset For $iY = 0 To $iH - 1 $iRowOffset = $iY * $iW + 1 For $iX = 0 To $iW - 1 $iRandom = Random(0, 0xFF, 1) DllStructSetData($tPixel, 1, 0xFF000000 + 0x10000 * $iRandom + 0x100 * $iRandom + $iRandom, $iRowOffset + $iX) Next Next _GDIPlus_BitmapUnlockBits($hImage, $tBitmapData) Return $hImage EndFunc should i replace $iRandom with integers from my file? what about image size; should i increase image size according to the size of my file?Edit: yup thats what i should do....thanks Edited November 20, 2015 by CrypticKiwi Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now