001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.commons.rng.sampling.distribution; 018 019import org.apache.commons.rng.UniformRandomProvider; 020 021/** 022 * Sampling from a <a href="https://en.wikipedia.org/wiki/Log-normal_distribution"> 023 * log-normal distribution</a>. 024 * Uses {@link BoxMullerNormalizedGaussianSampler} as the underlying sampler. 025 * 026 * @since 1.0 027 * 028 * @deprecated Since version 1.1. Please use {@link LogNormalSampler} instead. 029 */ 030@Deprecated 031public class BoxMullerLogNormalSampler 032 extends SamplerBase 033 implements ContinuousSampler { 034 /** Delegate. */ 035 private final ContinuousSampler sampler; 036 037 /** 038 * @param rng Generator of uniformly distributed random numbers. 039 * @param scale Scale of the log-normal distribution. 040 * @param shape Shape of the log-normal distribution. 041 */ 042 public BoxMullerLogNormalSampler(UniformRandomProvider rng, 043 double scale, 044 double shape) { 045 super(null); 046 sampler = new LogNormalSampler(new BoxMullerNormalizedGaussianSampler(rng), 047 scale, shape); 048 } 049 050 /** {@inheritDoc} */ 051 @Override 052 public double sample() { 053 return sampler.sample(); 054 } 055 056 /** {@inheritDoc} */ 057 @Override 058 public String toString() { 059 return sampler.toString(); 060 } 061}