I have a MySQL table wallet
with real data and I want to randomize this data to similar values based on original.
For example, update amount
column value on wallet
table with a RAND percent (from -20% to +20%) for all rows.
With PHP will be:
foreach (Wallet:select('id', 'amount')->get() as $row) {
$row->amount = $row->amount + ($row->amount * (rand(-20, 20) / 100));
$row->save();
}
Thanks!
Aucun commentaire:
Enregistrer un commentaire