Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
LCGRandom Class Reference

Public Member Functions

 LCGRandom (uint32_t seed)
 
SkScalar nextSScalar1 ()
 

Detailed Description

Utility class that implements pseudo random 32bit numbers using a fast linear equation. Unlike rand(), this class holds its own seed (initially set to 0), so that multiple instances can be used with no side-effects.

Copied from the original implementation of SkRandom. Only contains the methods used by SkDiscretePathEffect::filterPath, with methods that were not called directly moved to private.

Definition at line 41 of file SkDiscretePathEffect.cpp.

Constructor & Destructor Documentation

◆ LCGRandom()

LCGRandom::LCGRandom ( uint32_t  seed)
inline

Definition at line 43 of file SkDiscretePathEffect.cpp.

43: fSeed(seed) {}

Member Function Documentation

◆ nextSScalar1()

SkScalar LCGRandom::nextSScalar1 ( )
inline

Return the next pseudo random number expressed as a SkScalar in the range [-SK_Scalar1..SK_Scalar1).

Definition at line 48 of file SkDiscretePathEffect.cpp.

48{ return SkFixedToScalar(this->nextSFixed1()); }
#define SkFixedToScalar(x)
Definition SkFixed.h:124

The documentation for this class was generated from the following file: