RandomData()
Syntax
RandomData(*Buffer, Length)Description
Fills the specified memory buffer with random data. This command uses the same random seed as the Random() command. RandomSeed() may be used to change the random number seed.
Note: This command uses a pseudorandom number generator which is very fast and produces randomly looking output but it is not strong enough for cryptographic purposes. The slower CryptRandomData() command can be used if more secure random number generation is required.
Example:
; Create an image with random content ; CreateImage(0, 200, 200) If StartDrawing(ImageOutput(0)) *Buffer = DrawingBuffer() Pitch = DrawingBufferPitch() RandomData(*Buffer, Pitch*200) StopDrawing() EndIf OpenWindow(0, 0, 0, 200, 200, "Random Image", #PB_Window_SystemMenu|#PB_Window_ScreenCentered) ImageGadget(0, 0, 0, 200, 200, ImageID(0)) Repeat Until WaitWindowEvent() = #PB_Event_CloseWindow
Supported OS
All