Welcome Guest, you are in: Login

EventIDE Wiki



Search the wiki

Element Icon Random Noise Patch
Category: Stimulus Generators AddIn: Visual Kernels
Creator: OkazoLab Team Scope: Parent Event
Owns Snippets: no Usage: Screen

Actions aligned with epochs of the parent event

After event onsetThe patch is rendered on the screen


Generic Properties

NameDescriptionAttributesValue TypeUpon change
Patch TypeDefines a type of the random dot patchenum
Patch TypeDefines a type of the random dot patchenum
Random DistributionDefines a type of random distribution for the dots' valuesenum
Luminance RangeDefines the normalized range, 0..1, for the dot luminance. The full range, 0..1, corresponds to 0..255 in the RGB space. The range does not affects the color huesclRange
Patch ShapeDefines a shape of the generated patchenum
Random SeedDefines a seed value for the random noise patch. If the value is equal zero, a random seed value is automatically selected. Assigning a new value regenerates the patch.Int32
Runtime Status
Current SeedReturns the current seed of the random noise patch, when seed selection is automatic (the Random Seed property is set to zero). If the random seed is assigned manually, this property reflects the assigned value.Int32
Regenerate Patch NowRun-time command regenerating the patch. Use as 'RegeneratePatchNow=true;' in snippetsBoolean

+=== Properties inherited from clElement === Inherited properties of clElement
NameDescriptionConstraintsValue TypeUpon Change
Is EnabledIf set to false the element is completely omitted when the experiment is run.Boolean
TitleTitle of the element.String

+=== Properties inherited from clVisualElement ===
NameDescriptionConstraintsValue TypeUpon Runtime Change
Alpha MaskingDefines whether the visual content rendered by this element will be used as an opacity mask which is applied onto the given event surface. The active opacity mask allows one to expose pixels of the parent event surface through a solid background of the given event. If the value is true, the darker pixels of the content will make more transparent holes on the entire event surface.Boolean
AntiAliasingIf true, the rendered content will be anti-aliased for smoother visual appearance. If false, rendering will be authentic to its source, e.g. a bitmap. Boolean
PositionDefines the position of the element viewport on the screen. The position can be set in any of three coordinate systems: a) pixels, b) polar, c) central. clPoint
SizeDefines the size of the element viewport on the screen. The size can be set in any of three coordinate systems: a) pixels, b) visual degrees, c) 'relative-to-screen' size. clSize
Z OrderIndicates the current depth order of the element viewport on the surface of the parent event. The greatest number corresponds to the top position. The order can be changed by moving the element up and down in the element list.Int32
Pivot PointDefines the pivot point (coordinate and the rotation centers) within the element viewport. stAlignment or Int32
VisibleDefines whether the element is currently visible on the event surface. The property is convenient for switching visual content on and off. Boolean
RotationDefines the rotation angle (in degrees) of element viewport relative to the its pivot point. Double in the range 0..360
Transparent ColorThe color of the original pixels of rendered content that will be set as transparent. stColor
Transparency ToleranceTolerance ratio for choosing colors that become transparent. Zero means that effect is not applied, 1 denotes that all colors will become trasparent. Int32, range (0..100)
Color MaskProduces a multiplicative combination of the original pixels and the selected mask color (except the alpha channel). The effect emulates a look through a colored glass. White or transparent mask color doesn't change the original pixels. stColor
OpacityOpacity of the rendered content. Int32, range (0..100)
ContrastContrast of the rendered content. Int32, range (-100..100)
BrightnessDefines the brighness of the rendered content. Int32, range (-100..100)
SaturationSaturation of the rendered content. Double
PixelationDefines the pixel scale of the rendering. Int32, range (0..100)
BlurringThe radius used in the gaussian blur of rendered content, as a pixel-based factor. The default is 0 which means no blurring. Int32
Reset JitterSet to true at runtime to reset the current positional jitter.Boolean, set true for action
Current JitterJitter range, in pixels (non inclusive)..clSize
Jitter RangeJitter range, centered at the original position of the element.. clSize

The element generates a 2D noise patch, in which each pixel obtains a random gray luminance or luminance/color combination in the predefined range.


The random noise patch element can generate and render 2D noise patches controlled by several input parameters. The element employs hardware-accelerated graphics and fast randomization algorithm allowing generation of the noise stimuli in real-time.


The examples of rendered element with three available random dots types (the insets show zoomed patterns):

Random luminance surface

Random luminance surface

Random luminance&color surface

Random luminance&color surface

Random color surface

Random color surface

Practical Use

Generation of random dots surfaces via the graphics hardware implies certain limitations on type of a randomization algorithm. Our algorithm requires a relatively slow initialization where the random seed map is created by a standard random number generator. Later this seed map is used for generation of new random surfaces by ultra-fast shuffling of the original pixel positions.

There are two major ways of using the element for generation of multiple random dots surfaces (e.g., one per trial). Every surface generated by the element is defined by the index of the seed map and index of the surface itself. You may choose how to control these indexes in experiment.

If you need to present an incidental random dots surface (for example, for introducing a random noise to stimuli), you can setup the automatic time-dependent indexes. For this purpose, set two index properties [Seed map] and [Surface] to zero. Then the element will automatically generate the seed map and random dot surface with indexes that are random themselves. If you want to log these indexes, anytime you can read them in the statistical properties [Current Map] and [Current Surface]. In order to generate a new incidental surface at runtime you should initiate one of runtime actions in your code snippets: [Update Seed Map] or [Update Surface]. The runtime action is initiated by assigning TRUE to the property in a snippet.

If you need to present a deterministic random dots surface then you have to set the indexes manually, at design-time or in code snippets at runtime. You can do by assigning a certain positive integer value to the [Seed map index] or [Surface Index] properties which causes immediate regeneration of the surface. Thus, for the "deterministic" scenario you don't need to initiate the runtime actions [Update Seed Map] or [Update Surface].

In most cases the regeneration of the seed map is not necessary, since there are 2,147,483,648 unique random surfaces can be created with a single seed map.

By default, the seed map is generated with the same dimensions as a current size of the random dot element. If you change the size of the element in runtime, it might be a good practice to initiate regeneration of the seed map in parallel by the runtime action [Update Seed Map] - it will guarantee a correct randomization process.

Evaluation of the randomization algorithm

Our randomization algorithm of reshuffling the pixel positions has an important gain for many experimental scenarios – it allows keeping the overall luminance intensity of each generated surface nearly constant. The graph below demonstrates the frequency distribution of the RGB luminance for 10000 random dots surfaces (1024x768) generated by the random dots element. Notice that the entire distribution falls within a single RGB step.


The algorithm has been also tested for cross-correlation of two randomly selected pixels in a sequence of the generated surfaces. The results are shown below on the scatter plot. The cross-correlation has been found to be not significant after 10000 runs and r is -0.02. The red line shows the "zero" correlation trend with confidence intervals.


Our randomization algorithm has been designed to produce a continuous uniform distribution of random values for every pixel. For luminance the distribution falls within the standard gray RGB range, 0..255, by default. We evaluated the goodness of the produced uniform distribution by comparing it with the distribution of pixel sampling by the standard random number generator in the C# programming language. Below are three graphs showing frequency distributions of the RGB luminance for two pixels (coordinates are randomly selected) and the standard random numbers generated in ~ 10000 passes.


We assesses the most common statistical measures of all the obtained distributions and did not find significant differences in results between our and standard randomization algorithms. Notice the Kurtosis values in the table below, the negative values are indicative for the uniform distributions.

GeneratorNMeanSumMinimumMaximumVarianceStd. Dev.Std. ErrorKurtosis
Pixel A10000126.976013789590.00255.00005446.43573.799970.708176-1.18102
Pixel B10000128.808513988600.00255.00005457.43673.874460.708891-1.18804


1. If you need a random dots surface with individual dots larger than the screen pixel (like as a grid with large cells of random colors), the best way is to simply apply the pixelation effect with the selected ratio to the element. The pixelation effect would zoom the generated pixel pattern such that a color of the central pixel in each cell would define the color of the cell itself. Then the element can be rendered as on the example below.

The random dot surface, 1024x768, is rendered with the pixelation effect (pixilation ratio=86%)

2. You can enable different visual effects on the random dots element in order to obtain various rendering outputs, useful in real scenarios. One example below demonstrates the random dots surface made of only black and white pixels. The result is obtained with the contrasts visual effect set to +100%.

The element with the contrast filter (+100%) applied produces the surface that contains only black and white dots.

3. Another example below shows a monochromatic random dots surface made of combination of the gray random dots and the "orange" color filter effect.

The element with a monochromatic random dots surface made of combination of the gray random dots and the orange color filter effect.

ScrewTurn Wiki version Some of the icons created by FamFamFam.