Generate random deviates from a uniform distribution
Generate random deviates from a uniform distribution
new()
Create a new Uniform
object.
Uniform$new(sc, size, num_partitions, seed)
sc
A spark_connection
.
size
integer(1)
. The number of deviates to generate.
num_partitions
integer(1)
. Number of partitions in the RDD
(default: sc.defaultParallelism
).
seed
integer(1)
. The seed to set.
A new Uniform
object which is a RDD[Double]
comprised of
i.i.d. samples ~ U(0.0, 1.0)
.
\dontrun{ sc <- sparklyr::spark_connect(master = "local") unif <- Uniform$new( sc = sc, size = 10L, num_partitions = 1L, seed = 1L ) }
collect()
Collect the random deviates into R.
Uniform$collect()
\dontrun{ unif$collect() }
count()
Collect the random deviates into R.
Uniform$count()
\dontrun{ unif$collect() }
first()
Count the number of deviates.
Uniform$first()
\dontrun{ unif$count() }
get_num_partitions()
Get the number of partitions
Uniform$get_num_partitions()
\dontrun{ unif$get_num_partitions() }
clone()
The objects of this class are cloneable with this method.
Uniform$clone(deep = FALSE)
deep
Whether to make a deep clone.
## ------------------------------------------------ ## Method `Uniform$new` ## ------------------------------------------------ if (FALSE) { sc <- sparklyr::spark_connect(master = "local") unif <- Uniform$new( sc = sc, size = 10L, num_partitions = 1L, seed = 1L ) } ## ------------------------------------------------ ## Method `Uniform$collect` ## ------------------------------------------------ if (FALSE) { unif$collect() } ## ------------------------------------------------ ## Method `Uniform$count` ## ------------------------------------------------ if (FALSE) { unif$collect() } ## ------------------------------------------------ ## Method `Uniform$first` ## ------------------------------------------------ if (FALSE) { unif$count() } ## ------------------------------------------------ ## Method `Uniform$get_num_partitions` ## ------------------------------------------------ if (FALSE) { unif$get_num_partitions() }