UImportanceSamplingLibrary::RandomSobolFloat
#include "Kismet/ImportanceSamplingLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns a Sobol-distributed quasi-random number between 0 and 1 for the given sample index and dimension. Use for low-discrepancy sampling that fills a range more evenly than uniform random over many draws.
Caveats & Gotchas
- • Only 16 independent Sobol dimensions (0-15) are supported — requesting an out-of-range Dimension is not validated against a documented error and should be avoided.
- • Seed scrambles the sequence so different objects/instances don't sample identical points, but the same (Index, Dimension, Seed) always produces the same result — it's deterministic, not a fresh random draw each call.
- • For a running sequence of samples, NextSobolFloat is cheaper than recomputing RandomSobolFloat from scratch for each Index.
Signature
static float RandomSobolFloat(int32 Index, int32 Dimension, float Seed) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Index | int32 | Which sequential point in the Sobol sequence. | — |
| Dimension | int32 | Which Sobol dimension to draw from (0 to 15). | — |
| Seed | float | Random seed in the range 0-1 used to randomize (scramble) across multiple independent sequences. | — |
Return Type
float Example
Sample a low-discrepancy value per iteration C++
for (int32 i = 0; i < 64; ++i)
{
const float Sample = UImportanceSamplingLibrary::RandomSobolFloat(i, 0, 0.0f);
// use Sample to jitter a spawn position, etc.
} Tags
Version History
Introduced in: 5.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?